C++ Program for Largest Among Three Numbers

In this program, you'll learn to print largest among three numbers.



Source Code
#include<iostream>
using namespace std;

int main()
{
    int a, b, c;
    cout<<"Enter value of three variables: ";
    cin>> a >> b >> c;

    if(a > b)
    {
        if(a > c)
            cout<<"a is greater";
        else
            cout<<"c is greater";
    }
    else
    {
        if(b > c)
            cout<<"b is greater";
        else
            cout<<"c is greater";
    }
    return 0;
}
Output
Enter value of three variables:
45
81
24
b is greater