if- else ladder enter two number and check they are equal, grater or less to each other

C Programming Language Decision Making of C Language (Article) Decision Making of C Language (Program)

1325

Program:

#include"stdio.h"
int main()
{
    int number1, number2;
    printf("Enter two integers: ");
    scanf("%d %d", &number1, &number2);

    //checks if two integers are equal.
    if(number1 == number2)
    {
        printf("Result: %d = %d \n",number1,number2);
    }

    //checks if number1 is greater than number2.
    else if (number1 > number2)
    {
        printf("Result: %d > %d \n", number1, number2);
    }

    // if both test expression is false
    else
    {
        printf("Result: %d < %d \n",number1, number2);
    }

    return 0;
}

Output:

Enter two integers:  12   13
Result: 12 < 13
Press any key to continue . . .

This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.