Write a C program to Find the largest among three numbers
Program:-
#include <stdio.h>
int main()
{
int a,b,c;
printf("Enter three numbers : ");
scanf("%d %d %d", &a,&b,&c);
int max = 0;
if(a > b && a > c)
printf("\nThe largest among the three numbers is %d",a);
else if(b > a && b > c)
printf("\nThe largest among the three numbers is %d",b);
else
printf("\nThe largest among the three numbers is %d",c);
printf("\n");
return 0;
}
int main()
{
int a,b,c;
printf("Enter three numbers : ");
scanf("%d %d %d", &a,&b,&c);
int max = 0;
if(a > b && a > c)
printf("\nThe largest among the three numbers is %d",a);
else if(b > a && b > c)
printf("\nThe largest among the three numbers is %d",b);
else
printf("\nThe largest among the three numbers is %d",c);
printf("\n");
return 0;
}
Output:-
....
0 comments:
Post a Comment