FastFoodCoding

Login


Connect with one of the following accounts





Login

Please wait while we redirect...

Views: 30   



Following program shows you how to find largest number from given 2 numbers.
In this program we get inputs from user and shows largest number from given two numbers using if condition

#include <stdio.h>
int main(void) {
    int input1;
    int input2;

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

    printf("Enter second number:");
    scanf("%d", &input2);

    if (input1 == input2) {
        printf("%d is equal to %d ", input1, input2);

    } else if (input1 > input2) {
        printf("%d is larger than %d", input1, input2);

    } else {
        printf("%d is lesser than %d", input1, input2);
    }
}

output:

Example1:

Enter first number: 20
Enter second number: 30
20 is lesser than 30

Example2:

Enter first number: 50
Enter second number: 50
50 is equal to 50

Example3:

Enter first number: 100
Enter second number: 60
100 is larger than 60



On By


Top Tutorials

Top Questions

Top Articles

Top Blogs

Top News