Monday, August 29, 2011

Greater Number

Problem: Find which number is greater.

1. Prompt for two numbers.
2. Make a decision of which number is greater.
3. Print the appropriate message.

Source Code:
using namespace::std;
int main (void)
    int x,y;
    cout<<"Enter two numbers: ";
    (x>y)            //if x is greater
    cout<<x<<" is greater than "<<y<<endl;
    else if
    (x<y)            //if y is greater
    cout<<y<<" is greater than "<<x<<endl;
    else if (x==y)    //if both are equal
    cout<<"The numbers you entered are equal "<<endl;
    return 0;

0 response(s):

Respond to this Post

Your participation is appriciated...