Showing posts with label if else. Show all posts
Showing posts with label if else. Show all posts

Sunday, June 1, 2014

C++ Program to print largest number by if else

#include<iostream>
#include<conio.h>
using namespace std;
int main()
{

int a,b;//variable declaration
cout<<"Enter two numbers:";//prompt
cin>>a>>b;
if(a==b)
cout<<a<<"\n Both numbers are equal";
if(a>b)
cout<<a<<"\n is larger";
else
cout<<b<<"\n is larger";
getch();
}