maximum among 2 numbers

/* input 2 number and print the maximum among them.(with conditional operator) */

#include
#include
void main()
{
int x,y,max;
clrscr();
printf("enter number of value1");
scanf("%d",&x);
printf("enter number of value2");
scanf("%d",&y);
max = (x>y?x:y);
printf("maximum is %d",max);
getch();
}

0 comments:

Post a Comment