C program to find greatest of 4 numbers using conditional operator
Answers
Answered by
2
let 4 no. a b c d if a is greater than b c d A is bigger if b is greater than c and d b is bigger if c is greater than d c is bigger else d is greater
Answered by
8
#include<stdio.h>
int main()
{
int a,b,c,d,max;
printf("Enter 4 numbers ::");
scanf("%d%d%d%d",&a,&b,&c,&d);
//max=(a>b)?((a>c)?(printf("%d",a... of three
printf("\n\nThe max out of the nos. are ::");
max=(a>b)?((a>c)?((a>d)?(printf(... ):(printf("%d",d) )):((c>d)?(printf("%d",c) ):(printf("%d",d) ))):((b>c)?((b>d)?(printf("%d",b) ):(printf("%d",d) )):((c>d)?(printf("%d",c) ):(printf("%d",d) )));
getch();
}
int main()
{
int a,b,c,d,max;
printf("Enter 4 numbers ::");
scanf("%d%d%d%d",&a,&b,&c,&d);
//max=(a>b)?((a>c)?(printf("%d",a... of three
printf("\n\nThe max out of the nos. are ::");
max=(a>b)?((a>c)?((a>d)?(printf(... ):(printf("%d",d) )):((c>d)?(printf("%d",c) ):(printf("%d",d) ))):((b>c)?((b>d)?(printf("%d",b) ):(printf("%d",d) )):((c>d)?(printf("%d",c) ):(printf("%d",d) )));
getch();
}
Similar questions