Monday, October 1, 2012

C++ - Greatest number among two variables

#include<iostream.h>
#include<conio.h>
int main(void)
{
   int x,y,z;
   cout<<"\nEnter First Number : ";
   cin>>x;
   cout<<"\nEnter Second Number : ";
   cin>>y;
   if(x>y)
   {
      cout<<x<<" is greater than "<<y;
   }
   else if(y>x)
   {
      cout<<y<<" is greater than "<<x; 
   }
   else
   {
      cout<<"Both Numbers are equal"; 
   }
   return 0;
}

0 comments:

Post a Comment