codescracker


c++

C++ Program to Find Largest of Two Number



« Previous Program Next Program »


Find Largest of Two Number in C++

To find the largest number of the two number in C++ programming, you have to ask to the user to enter the two number to start checking which one is larger to display the largest number on the output screen as shown here in the following program.

C++ Programming Code to Find Largest of Two Number

Following C++ program ask to the user to enter the two number to find the greatest or largest of the two number, then display the result on the screen:

/* C++ Program - Find Largest of Two Numbers */
		
#include<iostream.h>
#include<conio.h>
void main()
{
	clrscr();
	int a, b, big;
	cout<<"Enter two number : ";
	cin>>a>>b;
	if(a>b)
	{
		big=a;
	}
	else
	{
		big=b;
	}
	cout<<"Biggest of the two number is "<<big;
	getch();
}

When the above C++ program is compile and executed, it will produce the following result. Above C++ Programming Example Output (for b):

C++ program find biggest of two

Above C++ Programming Example Output (for a):

C++ program find largest of two

Same Program in Other Language

You may like the same program in other programming languages:


« Previous Program Next Program »



Tools
Calculator

Quick Links
Signup - Login - Give Online Test