Program to find greater number among three numbers using ternary operator in C-language

#include<stdio.h>
int main()
{
    int a,b,c,x,y;
    printf("Enter first number\n");
    scanf("%d",&a);
    printf("Enter second number\n");
    scanf("%d",&b);
    printf("Enter third number\n");
    scanf("%d",&c);
   x=a>b?a:b;
   y=x>c?x:c;
    printf("Greatest number is=%d",y);
}

OUTPUT
Enter first number
8
Enter second number
56
Enter third number
89
Greatest number is=89

Comments

Popular posts

Creative pattern of butterfly in C-language

Program to show present time and date in C-language

Introduction of C-language.

Program to cheque enter number is a perfect number or not using if else in C-language

Program to cheque four digits number is palindrome or not in C-language

Program to print the cube of a number in c-language

Simple Hello world program in c- language