Header Ads Widget

Greatest among three numbers using if

#include<stdio.h>
int main()
{
int a,b,c,max; 
printf("Enter three numbers:");
scanf("%d %d %d",&a,&b,&c);
max=a;
if (b>max)
max=b;
if(c>max)
max=c;
printf("Greatest  no. = %d .",max);
return 0;

}

Output :
Enter three numbers:7
5
6
Greatest  no. = 7


Post a Comment

0 Comments