// PURPOSE : Print out the biggest and lowest DISTINCT values using the TERNARY operator
#include <stdio.h>
int main()
{
int a, b, c;
int max;
int min;
int salary;
float bonus;
printf("\n Please enter DISTINCT values for a, b, and c : ");
scanf_s("%d %d %d", &a, &b, &c);
// PRINTING the bigger of the two numbers using if-else statement
// i.e., without the use of the TERNARY operator
if (a > b)
{
printf("\n\n %d is bigger than %d", a, b);
}
else
{
printf("\n\n %d is bigger than %d", b, a);
}
// PRINTING the bigger number using the TERNARY operator
max= (a > b) ? a : b;
printf("\n The biggest of %d and %d is %d", a, b, max);
max = (a > b) ? ( (a > c) ? a : c) : ( ( b > c) ? b : c);
printf("\n The biggest of %d, %d, and %d is %d", a, b, c, max);
min = (a < b) ? ( (a < c) ? a : c) : ( (b < c) ? b : c);
printf("\n The smallest of %d, %d, and %d is %d", a, b, c, min);
getchar();
getchar();
return 0;
}