Q. Write a program to compare three numbers which is greatest,middle and lowest?
Ans.
#include<stdio.h>
#include<conio.h>
int main()
{
int x,y,z;
printf("Enter values of x, y and z : ");
scnaf("%d%d%d",&x,&y,&z);
if(x>=y && x>=z)
printf("
x=%d is greatest",a);
x=%d is greatest",a);
else if(y>=z)
printf("
y=%d is greatest",y);
y=%d is greatest",y);
else
printf("
z=%d is greatest",z);
getch();
return 0;
z=%d is greatest",z);
getch();
return 0;
}
Output of above program :
Enter values of x,y and z : 30
20
20
100
z=100 is greatest
0 comments:
Post a Comment