C++ program to input three integers and print the largest number

C++ program to input three integers and print the largest number

In this post we will discuss the C++ program of how to find the largest number amongst the three numbers.

C++ program to input three integers and print the largest number

// Program to input three integers and print the largest number
using namespace std;

#include<iostream>
#include<math.h>

int main()
{
    int a,b,c, large;
    
    cout<<"Enter the three integer numbers: "<<endl;
    cin>>a>>b>>c;
    
    if (a > b)
        if(a>c)
            large = a;
        else
            large = c;
    else if(b > c)
     		large = b;
        else
            large = c;
    cout<<"====input Data are ===="<<endl;
    cout<<"a = "<<a<<endl;
    cout<<"b = "<<b<<endl;
    cout<<"c = "<<c<<endl;
    cout<<endl;
    cout<<"largest number is = "<<large<<endl;
    
    return 0;
}

Output :-

largest number

largest number

Leave a Reply