Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Exercise 2.18
- //This program tells the user which of two numbers is larger or if they are equal
- #include <iostream>
- using namespace std;
- int num1{}, num2{};
- int main(){
- cout << "Please enter two numbers to compare:" << endl;
- cin >> num1 >> num2;
- if (num1 == num2){
- cout << "These numbers are equal" << endl;
- }
- if(num1 > num2){
- cout << num1 << " is larger";
- }
- if (num1 < num2){
- cout << num2 << " is larger";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement