Episode 9: Greatest Number Of 3

Share this content:

Programming for Greatest number of 3

Explanation:

Here we will be seeing a number which is greater than other 2 . Take 3 variable, compare each variable with other two. If it satisfies the condition that block will be executed.

code:

#include <stdio.h>
#include <conio.h>

void main()
{
int a,b,c;
printf(“\n Enter 3 Numbers:”);
scanf(“%d%d%d”,&a,&b,&c);

if(a>b && a>c)
{
printf(“%d is greatest”,a);
}
else if(b>a && b>c)
{
printf(“%d is greatest”,b);
}
else
{
printf(“%d is greatest”,c);
}

getch();

}

Output:
Enter 3 Numbers:12
54
32
54 is greatest

Share this content:

Leave a Reply

Your email address will not be published. Required fields are marked *

TechGenBlog © 2017 | With ❤ From India