WAP to find greatest of three number using conditional operator
{ Conditional Operator :
The conditional operator is also known as a ternary operator. The conditional statements are the decision-making statements which depends upon the output of the expression. It is represented by two symbols, i.e., '?' and ':'.
As conditional operator works on three operands, so it is also known as the ternary operator.
The behavior of the conditional operator is similar to the 'if-else' statement as 'if-else' statement is also a decision-making statement. }
Code ::
#include<stdio.h>
int main(){
int a,b,c;
int big;
printf("Enter any three numbers: ");
scanf("%d%d%d",&a,&b,&c);
if(a>b && a>c)
big = a;
else if(b>c)
big = b;
else
big = c;
printf("Largest number is: %d",big);
return 0;
}
Output::