Breaking News

C++ Program To Find Largest Of Three Numbers

This program is to find biggest of three numbers.

Algorithm:

1.Start
2.Get the inputs from user for variables a, b, c (ie) three integer numbers
3.Compare whether value of a is greater than the value of b
4.If step-3 is then compare whether a is greater than value of c
5.If step-3 & step-4 are true print a "Is Greater Than" b "&" c
6.If step-3 is false then compare value of b & value of c if b is greater print b "Is Greater Than" a "&" c else print c "Is Greater Than" a "&" b
7.Stop


Program:

# include <iostream.h>
# include <conio.h>
void main ()
{
           clrscr();
           int a, b, c;
           cout << "Enter The Value For A:";
           cin >> a;
           cout << "Enter The Value For B:";
           cin >> b;
           cout << "Enter The Value For C:";
           cin >> c;
           if (a> b)
           {
                     if (a> c)
                     {
                            cout << a << "Is Greater Than" << b << "&" << c;
                     }
           }
            else if (b> c)
            {
                       cout << b << "Is Greater Than" << a << "&" << c;
             }
             else
             {
                        cout << c << "Is Greater Than" << a << "&" << b;
              }
             getch ();
}

No comments