Write a program in C++ to find Highest of 3 numbers using nested if else

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

int main() {   
    int a, b, c;
            
    cout << "First No: ";
    cin >> a;
    
    cout << "Second No: ";
    cin >> b;
    
    cout << "Third No: ";
    cin >> c;
    
    if (a>b) {
       if(a>c)
          cout << a << " is highest";
       else 
          cout << c << " is highest";
    } else {
       if(b>c)
          cout << b << " is highest";
       else 
          cout << c << " is highest";
    }
      
    getch();
    return 0;
}

Output:



Search Tags: c++ programs, cpp programs, c++ practice programs, cpp practice programs, nested if else, highest number, maximum number

Leave a Reply

Contact Form

Name

Email *

Message *

Followers