PROGRAM : Biggest of three numbers
#include<stdio.h>
int main()
{
int
num1,num2,num3;
printf("Enter
a number 1\n");
scanf("%d",&num1);
printf("Enter
a number 2\n");
scanf("%d",&num2);
printf("Enter
a number 3\n");
scanf("%d",&num3);
//Comparing 1 with 2 and 1 with 3
//Comparing 1 with 2 and 1 with 3
if((num1>num2)
&& (num1>num3))
printf("%d
is bigger\n",num1);
//Comparing 2 with 1 and 2 with 3
//Comparing 2 with 1 and 2 with 3
else
if((num2>num1) && (num2>num3))
printf("%d
is bigger\n",num2);
//If above cases fails then third is the biggest number
//If above cases fails then third is the biggest number
else
printf("%d
is bigger\n",num3);
return 0;
}
OUTPUT :
No comments:
Post a Comment