How to find greatest of three numbers using multiple if statement in C++ Language

IntroductionIn previous post i explained the program for Else if ladder to perform operation on two numbers based on operator in C++ language. In this article i will explain How to find greatest of three numbers using multiple if statement  in C++ Language. Let's create a program to understand.

#include<conio.h>
#include<iostream.h>
main()
{
      int a,b,c,big;
      cout<<"Enter first number: ";
      cin>>a;
      cout<<"Enter second number: ";
      cin>>b;
      cout<<"Enter third number: ";
      cin>>c;
   
      if(a>b)
      {
            big=a;
        }
       if(a<b)
        {
            big=b;
        }
        if(big<c)
         {
             big=c;
          }
                          cout<<"Biggest number="<<big;
                 getch();
      }
  • Run the program using Ctrl+F9
Output:

Enter first number: 45
Enter second number: 90
Enter third number: 99
Biggest number=99
Previous
Next Post »

If you have any question about any post, Feel free to ask.You can simply drop a comment below post or contact via Contact Us form. Your feedback and suggestions will be highly appreciated. Also try to leave comments from your account not from the anonymous account so that i can respond to you easily..