Question : Write a C Program to find greatest in 3 numbers.
/*
Write a C Program to find greatest in 3 numbers.
*/
#include <stdio.h>
int main()
{
int num1,num2,num3;
//Ask user to input any three integer numbers
printf("\n Enter value of num1, num2 and num3:");
//Store input values in variables for comparsion
scanf("%d %d %d",&num1,&num2,&num3);
if((num1>num2)&&(num1>num3))
{
printf("\n Number1 is greatest");
}
else if((num2>num3)&&(num2>num1))
{
printf("\n Number2 is greatest");
}
else
{
printf("\n Number3 is greatest");
}
return (0);
}
OUTPUT :
Enter value of num1, num2 and num3: 15 200 101
Number2 is greatest
Thank you very much for reading carefully, if you have any other questions, you can share it with us through comments, if this information was important to you, please let us know through comments.
Please do comment and share.
Thank You.
No comments:
Post a Comment