Largest of 4 numbers using conditional operator in c
Answers
Answered by
0
#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