C++ Program to find Greatest number between three Numbers

ad+1

Program:

// Program By http://solutionscpp.blogspot.com
// Author Mansoor Ahmed
// GMail ID: secguy000@gmail.com

#include<iostream>
using namespace std;

int main()
{
    int n1=0, n2=0, n3=0;
    cout<<"Enter first number: ";
    cin>>n1;

    cout<<"Enter second number: ";
    cin>>n2;

    cout<<"Enter third number: ";
    cin>>n3;
   
    if(n1>n2&&n1>n3)
    {
     cout<<n1 <<" is greatest of all";
    }
   
    else if(n2>n1&&n2>n3)
    {
     cout<<n2 <<" is greatest of all";
    }
   
    else
    {
     cout<<n3 <<" is greatest of all";
    }

}

Output:

2 comments: Leave Your Comments

  1. A nice piece of code and an even better looking blog.
    Keep it up!

    ReplyDelete