Nov 22, 2017 Awais Liaqat

C++ Program To Find Greatest Number Between Three Numbers
5   6   53   Programming - C++

Facebook   Twitter   Google   Email
post-img
 

Introduction

This program shows the greatest number between three numbers using if-else-if statement. It takes three numbers as input from user and output the greatest number.


Source Code:

#include<iostream>
using namespace std;
int main()
{
    int n1, n2, n3;
    cout<<"Enter First Number: ";
    cin>>n1;

    cout<<"Enter Second Number: ";
    cin>>n2;

    cout<<"Enter Third Number: ";
    cin>>n3;
    if(n1 > n2 && n1 > n3)
    {
        cout<<"First number is greatest "<<endl<<"which is: "<<n1;
    }
    else if(n2 > n1 && n2 > n3)
    {
        cout<<"Second number is greatest "<<endl<<"which is: "<<n2;
    }
    else
    {
        cout<<"Third number is greatest "<<endl<<"which is: "<<n3;
    }
    return 0;
}

Is this helpful?   Yes   No

Facebook   Twitter   Google   Email
Click to copy
Successfully copy the link to share

Leave a Comment


Comments (6)


Thank you for your feedback
You are now following
Request Sent! Wait for Approval
Removed From Following
Something wents wrong!
Thank you for your comment