Check if X is Less than or Equal to Y (Using Ternary Operator)

Accept two numbers and Y as the input. The program must print YES if X is less than or equal to Y. Else the program must print NO as the output using ternary operator.

Example Input/Output 1:
Input:
6 3

Output:
NO

Example Input/Output 2:
Input:
78 343

Output:
YES

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

Binary Prefix Count - Divisible by X

Next Article

Matrix - Remove Apples & Oranges

Write a Comment

Leave a Comment

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