Smaller of Two Numbers (Using Ternary Operator)

Accept two numbers and as input. The program must print the smaller of two numbers as the output using ternary operaor.

Example Input/Output:
Input:
30 90

Output:
30

#include<stdio.h>
#include <stdlib.h>
int main()
{
    int X, Y;
    scanf("%d %d",&X,&Y);
    printf("%d", (X<Y)?X:Y);
    return 0;
}
Previous Article

Function getUniqueUnitDigits

Next Article

Function customToUpper

Write a Comment

Leave a Comment

Your email address will not be published. Required fields are marked *