Biggest of 3 numbers using ternary operator
Program:
#include<stdio.h>
#include<conio.h>
void main()
{
int a, b, c, big;
clrscr();
printf("Enter three numbers : ");
scanf("%d %d %d", &a, &b, &c);
big = a > b ? (a > c ? a : c) : (b > c ? b : c);
printf("\nThe biggest number is : %d", big);
getch();
}
Output:
Enter three numbers : 10 20 30
The biggest number is : 30
-
UpdatedDec 30, 2019
-
Views11,301
You May Like
Program to maintain employee details using structures
Program to maintain student details using structures
Check whether the person is eligible to vote or not
Print the numbers that are divisible by a given no.
Program to generate magic square
To sort the given numbers in ascending & descending order