Coding Practice

Write a C program to find maximum between two numbers

Find maximum between two numbers
Sample Output
Enter first number: 45

Enter second number: 31

45 is maximum number.

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

int main()
{
    int num1, num2;

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

Enter second number: 24

24 is maximum number.

Process returned 0 (0x0)   execution time : 8.372 s
Press any key to continue.

No comments:

Post a Comment

Change Theme
X