Friday, January 21, 2011

Operators and Expressions

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();
}

No comments:

Post a Comment