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

Accept two integers X and Y as the input. The program must print the larger integer as the output.

Example Input/Output:
Input:
12 15

Output:
15

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

Print YES or NO (Using Logical AND)

Next Article

Print Odd or Even (Using if-else)

Write a Comment

Leave a Comment

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