Breaking News
recent

Program Perbandingan Dua Bilangan C++

#include <iostream>

using namespace std;

int main()
{
    int num1, num2;

    cout << "Enter two integers, and I will tell you\n";
    cout << "the relationships the satisfy: ";
    cin >> num1 >> num2;

    if (num1 == num2)
        cout << num1 << "is equal to " << num2 << endl;

    if (num1 != num2)
        cout << num1 << " is not equal to " << num2 << endl;

    if (num1 < num2)
        cout << num1 << " is less than " << num2 << endl;

    if (num1 > num2)
        cout << num1 << " is greate than " << num2 << endl;

    if (num1 <= num2)
        cout << num1 << " is less than or equal to " << num2 << endl;

    if (num1 >= num2)
        cout << num1 << " is greater than or equal to " << num2 << endl;

    return 0;
}

Ahmad

Ahmad

No comments:

Post a Comment

Powered by Blogger.