C Program to find smallest of three numbers using Conditional Operator
Program
#include<stdio.h>
void main()
{
int a, b, c;
printf("Enter three numbers\n");
scanf("%d %d %d", &a, &b, &c);
((a < b) && (a < c)) ? printf("a is smallest\n") :
(b < c) ? printf("b is smallest\n") :
printf("c is smallest\n");
}
Output 1
Enter three numbers
10
24
65
a is smallest
Output 2
Enter three numbers
45
31
65
b is smallest
Output 3
Enter three numbers
78
54
31
c is smallest