Friday, 5 July 2013

Accept two numbers from a user and find the greatest of the two.

#include<iostream>
using namespace std;
int main()
{
float a,b;   
cout<<"Enter the first number: ";
cin>>a;
cout<<"Enter the second number: ";
cin>>b;
if(a>b)
{
cout<<a<<" is bigger than "<<b;
}
if(a==b)
{
cout<<a<<" is equal to "<<b;
}
if(a<b)
{
cout<<b<<" is bigger than "<<a;
}
}

No comments:

Post a Comment