Greatest from three numbers


#include<iostream.h>
#include<conio.h>

void main()
{
    int a, b, c;
    clrscr();

    cout<<"Enter three numbers:";
    cin>>a>>b>>c;

    if (a > b)
    {
        if (a > c)
        {
            cout<<"First number is greatest: "<<a;
        }
        else
        {
            if (b > c)
            {
                cout<<"Second number is greatest: "<<b;
            }
            else
            {
                cout<<"Third number is greatest: "<<c;
            }
        }
    }
    else
    {
        if (b > c)
        {
            cout<<"Second number is greatest: "<<b;
        }
        else
        {
            cout<<"Third number is greatest: "<<c;
        }
    }
}
Previous Post Next Post