Pages

Wednesday, April 9, 2014

comparison of three numbers

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);
 else if(y>=z)
   printf("
y=%d is greatest"
,y);
 else
   printf("
z=%d is greatest"
,z);

 getch();
 return 0;
}

      Output of above program :
Enter values of x,y and z : 30
20
100

z=100 is greatest

Related Posts by Categories

0 comments:

Post a Comment