Sep 14, 2013

A C++ program to find the largest value of any three numbers

Unknown | 1:20 PM |
Now I am telling you how to find the largest value of any three numbers with C++ program.

If you enter any three numbers you will get the largest value from these. It's so simple and easy program.




However, Let's start our program. 

#include <iostream.h>
void main( void)
{
 float x,y,z;
 cout << "Enter any three numbers \n";
 cin >> x >> y >> z;
 if (x > y) {
if (x > z)
cout <<"Largest value" << x << endl;
else
cout <<"Largest value" << z << endl;
}
else if (y > z)
cout <<"Largest value" << y << endl;
else
cout <<"Largest value" << z << endl;
} // end of main program

You can see this output:

Enter any three numbers
10     40      50
Largest value 50

No comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

Search