C program to find greatest of 3 numbers using conditional operator
Answers
Answered by
6
Answer:
# include <stdio.h>
void main()
{
int a, b, c, great ;
printf("Enter three numbers : ") ;
scanf("%d %d %d", &a, &b, &c) ;
great = a > b ? (a > c ? a : c) : (b > c ? b : c) ;
printf("\nThe biggest number is : %d", great) ;
}
Answered by
8
Biggest Of Three Numbers Using Conditional operator/Ternary Operator in C
# include <stdio.h>
void main()
{
int a, b, c, big ;
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)
Similar questions