Print YES or NO (Using Logical AND)

Accept a number X as the input. The program must print YES if it is greater than 3 and less than 10. Else print NO as the output using logical AND.

Example Input/Output 1:
Input:
5

Output:
YES

Example Input/Output 2:
Input:
19

Output:
NO

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

Find Hundredth Digit

Next Article

Print the Larger of Two Numbers (Using if-else)

Write a Comment

Leave a Comment

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