/* Find largest value among three variable using conditional operator */
#include<stdio.h>
int main()
{
int a,b,c,d;
printf("Type values of A,B and C : ");
scanf("%d %d %d",&a,&b,&c);
d=(a>=b?a>=c?a:c:b>=c?b:c);
printf("Greatest value : %d",d);
return 0;
}
#include<stdio.h>
int main()
{
int a,b,c,d;
printf("Type values of A,B and C : ");
scanf("%d %d %d",&a,&b,&c);
d=(a>=b?a>=c?a:c:b>=c?b:c);
printf("Greatest value : %d",d);
return 0;
}
No comments:
Post a Comment