C Program to find the largest ( biggest or greatest or maximum ) among 10 numbers using Conditional ( ternary ) Operator

We can find the largest (biggest or greatest or maximum) of 10 numbers using Conditional (ternary) Operator. Now, We can write C Program to find the largest (biggest or greatest or maximum) among ten numbers using Conditional (ternary) Operator. For example: if we input as 34, -67, 28, 12, 30, -43, 86, 24, 33, 75 then the largest (biggest or greatest or maximum) among 10 numbers is 86. The below given C program will find the largest (biggest or greatest or maximum) of ten numbers using Conditional (ternary) Operator. Kindly check out the program to find largest (biggest or greatest or maximum) of 10 numbers.

Program to find largest of 10 numbers using Conditional (ternary) Operator.

#include<stdio.h>

int main()

{

int a, b, c, d, e, f, g, h, i, j, p, q, w, x, y, z, large;

clrscr();

printf(" Enter any Ten integer numbers : ") ;

scanf("%d %d %d %d %d %d %d %d %d %d", &a, &b, &c, &d, &e, &f, &g, &h, &i, &j) ;

x = (a > b? a : b);

y = (c > d? c : d);

z = (e > f? e : f);

p = (g > h? g : h);

q = (i > j? i : j);

w = x > y ? ( x > z ? x : z) : (y > z ? y : z) ;

large = p > q ? ( p > w ? p : w) : (q > w ? q : w) ;

printf("



The largest of Ten numbers using Conditional ternary Operator is : %d", large) ;

getch();

return 0;

}

Sample Output: Enter any Ten integer numbers : 45 54 21 -89 49 11 90 22 -58 72

The largest of Ten numbers using Conditional ternary Operator is : 90

Program to find largest of 6 numbers using Conditional (ternary) Operator.