Write a C program to find the greatest among three numbers
#include<stdio.h>
int main()
{
int num1,num2,num3;
printf("Enter three numbers: \n");
scanf("\n%d \n%d \n%d", &num1, &num2, &num3);
if(num1>num2 && num1>num3)
{
printf("%d is greater", num1);
}
else if(num2>num1 && num2>num3)
{
printf("%d is greater", num2);
}
else(num3>num1 && num3>num2)
{
printf("%d is greater", num3);
}
return 0;
}
Comments
Post a Comment