C Program to find maximum between two numbers


Write a C Program to find the maximum between two numbers using if-else conditional statement.

C Program to find the maximum between two numbers

#include <stdio.h>

void main()
{
    int num1, num2;
    printf("Enter first number: ");
    scanf("%d", &num1);
    printf("Enter second number: ");
    scanf("%d", &num2);
    if(num1 == num2)
        printf("Both are equal");
    else if(num1 > num2)
        printf("%d is greater than %d", num1, num2);
    else
        printf("%d is greater than %d", num2, num1);
}

Recommended Posts