by R4R Team

-Here we try to find the maximum number between three number
Example-
first number is 1
second number is 90
third number is 45
then 45 is maximum

program-


#include < stdio.h>
int main()
{
int a,b,c;
printf("Enter First number\n");
scanf("%d",&a);
printf("Enter Second number\n");
scanf("%d",&b);
printf("Enter Third number\n");
scanf("%d",&c);
if(a>b && a>c)
{
printf("%d is maximum",a);
}
else
{
if(b>c)
printf("%d is maximum",b);
else
printf("%d is maximum",c);
}
}


output-

Enter First Number
23
Enter Second Number
12
Enter Third Number
9
23 is maximum

Enter First Number
-90
Enter Second Number
12
Enter Third Number
1
12 is maximum

-In this program, we take an input of three number and store in variable 'a','b' and 'c'.
-then if(a>b && a>c) will execute if 'a' is greator than two other number otherwise it will execute else part.
-then if(b>c) will execute if 'b' is greator than 'c' otherwise else part execute and third number is show as a greatest number.




Leave a Comment: