Given three values, write a program to read three values from keyboard and print out the largest of
them without using if statement.
#include<stdio.h>
void main()
{
int x,y,x,R;
printf("Enter three integer number\n");
scanf("%d %d %d",&x,&y,&z);
R=(x>y)?((x>z)?x:z):((z>y)?z:y);
printf("Largest number is %d",R);
getch();
}
them without using if statement.
#include<stdio.h>
void main()
{
int x,y,x,R;
printf("Enter three integer number\n");
scanf("%d %d %d",&x,&y,&z);
R=(x>y)?((x>z)?x:z):((z>y)?z:y);
printf("Largest number is %d",R);
getch();
}
No comments:
Post a Comment