Coding Practice

Write a C program to find maximum between three numbers

Find maximum between three numbers
Sample Output
Enter first number: 56

Enter second number: 98

Enter third number: 37

98 is maximum number.

Process returned 0 (0x0)   execution time : 17.875 s
Press any key to continue.
Source Code
#include<stdio.h>

int main()
{
    int num1, num2, num3;

    printf("Enter first number: ");
    scanf("%d", &num1);

    printf("\nEnter second number: ");
    scanf("%d", &num2);

    printf("\nEnter third number: ");
    scanf("%d", &num3);

    if(num1 > num2 && num1 > num3)
    {
        printf("\n%d is maximum number.\n", num1);
    }
    else if(num2 > num1 && num2 > num3)
    {
        printf("\n%d is maximum number.\n", num2);
    }
    else
    {
        printf("\n%d is maximum number.\n", num3);
    }
    return 0;
}
Sample Output
Enter first number: 56

Enter second number: 98

Enter third number: 37

98 is maximum number.

Process returned 0 (0x0)   execution time : 17.710 s
Press any key to continue.
Change Theme
X