Finding Maximum...
#include <stdio.h>
int main()
{
int a, b, c;
printf("Enter 1st Number : ");
scanf("%d", &a);
printf("Enter 2nd Number : ");
scanf("%d", &b);
printf("Enter 3rd Number : ");
scanf("%d", &c);
// checking the greatest number out of 3 numbers
//if first number is greater
if ((a > b) && (a > c))
{
printf("%d is the greatest number.", a);
return 0;
}
//if second number is greater
if ((a < b) && (c < b))
{
printf("%d is the greatest number.", b);
return 0;
}
//if third number is greater
printf("%d is the greatest number.", c);
return 0;
}
No comments:
Post a Comment