Pages

Friday, July 21, 2017

C++ Program to find bigger number.

C++ Program to find bigger number. Program will demonstrate use of if ... statement.

#include<iostream>
using namespace std;
int main()
{
    int num1, num2;

    cout << "Enter number1:";
    cin >> num1;

cout << "Enter number2:";
    cin >> num2;

    if(num1 > num2)
    {
        cout << "Number1 is big.";
    }
    if(num2 > num1)
    {
        cout << "Number2 is big.";
    }
    if(num1 == num2)
    {
        cout << "Number1 and Number2 are equal.";
    }
    return 0;
}

Output of program

Enter number1:5
Enter number2:10
Number2 is big.


No comments:

Post a Comment