/* To find the
greatest among three numbers using conditional operator */
#include<stdio.h>
#include<conio.h>
void
main()
{
int a,b,c;
clrscr();
printf("Enter any three
numbers:\n");
scanf("%d%d%d",&a,&b,&c);
/* Using Conditional Operator */
a>b ? (a>c ? printf("%d is
greatest",a): printf("%d is greatest",c))
: (b>c ? printf("%d is
greatest",b): printf("%d is greatest",c));
getch();
}
OUTPUT
Enter
any three numbers:
23
49
37
49
is greatest
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.