Thursday, July 28, 2011

Largest among 3 numbers

#include<stdio.h>
void main()

{
int big,num1,num2,num3;
clrscr();
printf("Enter 3 numbers to find largest : ");
scanf("%d%d%d",&num1,&num2,&num3);
/* Use of conditional statement
   expn1?expn2:expn3;           */
big=(num1>num2)?((num1>num3)?num1:num3):((num2>num3)?num2:num3);
printf("big is %d",big);
getch();
}

No comments:

Post a Comment