#include(stdio.h)
#include(conio.h)
int main( )
{
int a, b, c, d;
clrscr( );
printf("Enter the four different numbers:")l
scanf(" %d %d %d %d", &a, &b, &c, &d);
if(a>b && a>c && a>d)
printf("\n%d is greatest", a);
else if(b>a && b>c && b>d)
printf("\n%d is greatest", b);
else if(c>a && c>b && c>d)
printf("\n%d is greatest", c);
else
printf("\n %d is greatest", d);
getch( );
}
Note:- if u have any doubts regarding this program, feel free to contact my email id
Friday, June 19, 2009
Subscribe to:
Post Comments (Atom)
pls help me 2 write it simply using conditional operator without using an xtra variable.I'm only at d footsteps of c++.pls get it as soon as possibl.
ReplyDeleteif program above written without using if condition then
ReplyDeletepls help me 2 write it simply using conditional operator without using an xtra variable.
ReplyDeletethank U was helpful
ReplyDelete5 7 7 5 output shows wrong
ReplyDeleteHey bro condition is four different No.
Deleteint m;
ReplyDeletem=(a>b && a>c && a>d ) ? a: ((b>c && b>d) ? b : ((c>d)?c : d));
printf("%d",m);
// m is the greatest
ok
ReplyDeleteGood
ReplyDelete