Answer to Question #291944 in C++ for barken

Question #291944

write a pseudo code for a program to find the greater number between two numbers


1
Expert's answer
2022-01-31T07:56:24-0500
#include<iostream>

using namespace std;

/*Algorithm
  1) Ask user to enter two integer values
  2) Read two values in variables x and y
  3) Check if x is greater than y
  4) If true, then print x as the greatest number
  5) If false, then print y as the greatest number
  6) Else, both are equal
  */
int main()
{
	int x,y;
	cout<<"Please, enter two integer values: ";
	cin>>x>>y;
	if(x>y)
		cout<<x<<" is the largest value";
	else if(y>x)
		cout<<y<<" is the largest value";
	else
		cout<<"Both values 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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog