0
6.2kviews
Write a program to find the biggest of given 3 no's using conditional operator.
1 Answer
0
1.6kviews

Algorithm:

  • Start.
  • Initialize variables a b c and big.
  • Using conditional operator compare three numbers.
  • Assign biggest number to big and print the number.
  • Stop.

Program Code:

#include<stdio.h>
int main() {
    int a,b,c,big;
    printf("\nEnter 3 numbers:");
    scanf("%d %d %d", &a, &b, &c);
    big=(a>b && a>c? a:b>c? b:c);
    printf("\nThe biggest number is:%d", big);
    return 0;
}

Output:

Enter 3 numbers: 10 30 20

The biggest number is: 30

Please log in to add an answer.