Question #340331

Write a program that asks the user to enter two integers, obtains the numbers from the



user, then prints the larger number followed by the words “is larger.” If the numbers



are equal, print the message “These numbers are equal.”

Expert's answer

#include<iostream>


using namespace std;


int main()
{
	int x, y;
	cout << "Please, enter two integers: ";
	cin >> x >> y;
	if (x > y)
		cout << x << " is larger";
	else if (y > x)
		cout << y << " is larger";
	else
		cout << "These numbers are equal.";
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS