C++ Program To Find Largest Number Among Three Numbers


Aim :- Write a C++ Program To Find Largest Number Among Three Numbers.

In this program, user is asked to enter three numbers.
Then this program finds out the largest number among three numbers entered by user and displays it with proper message.
We will find the largest number among three numbers using if, if else and nested if else statements.


C++ Program Code :



#include <conio.h>
#include <iostream.h>
void main()
{
      int a,b,c;
      clrscr();
      cout<<"\nC++ Program To Find Largest Number From The Given 3 Numbers";
      cout<<"\nEnter The Value of a : ";
      cin>>a;
      cout<<"\nEnter The Value of b : ";
      cin>>b;
      cout<<"\nEnter The Value of c : ";
      cin>>c;
      if(a>b&&a>c)
      {
            cout<%lt;"\nLarger Value Is a : "<%lt;a; 
      }
      else if(b>a&&b>c)
      {
            cout<%lt;"\nLarger Value Is b : "<%lt;b;
      }
      else
      {
            cout<%lt;"\nLarger Value Is c : "<%lt;c;
      }
      getch();
}


Output :


Post a Comment

0 Comments