? :,Conditional Expression or ternary operator, Find largest number among 3 numbers using ternary operator

C Programming Language / Operators and Enums in C Language

999

Program:

#include <stdio.h>
int main()
{
int a, b, c, large;
 
printf("Enter any three number: ");
scanf("%d%d%d",&a,&b,&c);
large=a>b ? (a>c?a:c) : (b>c?b:c);
printf("Largest Number is: %d \n",large);
 
}

Output:

Enter any three number: 1 2 3
Largest Number is: 3
Press any key to continue . . .

This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.