write a pseudo code for a program to find the greater number between two numbers
#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";
}
Comments
Leave a comment