C++ Program To Find Largest Among Two Numbers
This program is to find biggest of two numbers.
Algorithm:
1.Start
2.Get the inputs from user for variables a, b (ie) two integer numbers
3.Compare whether value of a is greater than the value of b
4.If step-3 is true print a "Is Greater Than" b else print b "Is Greater Than" a
5.Stop
Program:
# include <iostream.h>
# include <conio.h>
void main ()
{
clrscr();
int a, b;
cout << "Enter The Value For A:";
cin >> a;
cout << "Enter The Value For B:";
cin >> b;
if (a> b)
{
cout << a << "Is Greater Than" << b;
}
else
{
cout << b << "Is Greater Than" << a;
}
getch ();
}
Algorithm:
1.Start
2.Get the inputs from user for variables a, b (ie) two integer numbers
3.Compare whether value of a is greater than the value of b
4.If step-3 is true print a "Is Greater Than" b else print b "Is Greater Than" a
5.Stop
Program:
# include <iostream.h>
# include <conio.h>
void main ()
{
clrscr();
int a, b;
cout << "Enter The Value For A:";
cin >> a;
cout << "Enter The Value For B:";
cin >> b;
if (a> b)
{
cout << a << "Is Greater Than" << b;
}
else
{
cout << b << "Is Greater Than" << a;
}
getch ();
}
No comments