C Program to find maximum between three numbers


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

C Program to find maximum between three numbers

#include <stdio.h>

void main()
{
    int num1, num2, num3;
    printf("Enter first number: ");
    scanf("%d", &num1);
    printf("Enter second number: ");
    scanf("%d", &num2);
    printf("Enter third number: ");
    scanf("%d", &num3);
    if(num1 > num2 && num1 > num3)
        printf("%d is maximum", num1);
    else if(num2 > num1 && num2 > num3)
        printf("%d is maximum", num2);
    else
        printf("%d is maximum", num3);
}

Recommended Posts