Articles

# C++ program to find greatest of three numbers

In this c++ programs guide, we are going to write a:

• c++ program to find greatest of three numbers

### C++ program to find maximum between three numbers

Given below is a c++ program to find greatest of three numbers:

``````/* program author:AYUSH BAJPAI*/
#include<iostream>
using namespace std;
int main() {
int a,b,c;
cout<<"enter three numbers\n";
cin>>a>>b>>c;
if(a>b)
{
if(a>c)
{
cout<<a<<" is greatest number";
}
else
{
cout<<b<<" is greatest number";
}
}
else
{
if(b>c)
{
cout<<b<<" is greatest";
}
else
{
cout<<c<<" is greatest";
}
}
return 0;
}``````
``````INPUT:
enter three numbers
24
28
67``````
``````OUTPUT:
67 is greatest``````

### Explanation:

In this article we have learned how to find max of three numbers in c++ entered as input in c++ program.
``#include<iostream>``
• iostream stands for standard input-output stream.It helps us to include the basic input-output functions in our program like cin and cout.
• using namespace std; : It means we are going to use the namespace of std.std is an abbreviation which stands for standard.
• every c++ program starts with a main() function.so we have use the int main() function in the starting of the program.
• cout and cin:cout and cin are used as basic input output functions.cout is used to output the formatted data on the screen.cin is used to get input from the user.
• return 0: it is used to indicate the exit status of the main() function .

You can now see the execution of write a program to find maximum of three numbers in c++ code through command prompt. Hope you liked this article on write a program to find maximum of three numbers in c++. Thanks for reading.👍👍👍👍

CPP Programs

Would you like to see your article here on tutorialsinhand. Join Write4Us program by tutorialsinhand.com 