19 April, 2012

write a program to find maximum value and minimum value

write a program to find maximum value and minimum value of 3 any number entered from the keyboard


Code:
 # Include using namespace std;
void max (float a, float b, float c)
{
	if (a> b)
		if (a> c)
			cout << "highest number" << a << endl;
		else
			cout << "highest number" << c << endl;
	else
		if (b> c)
			cout << "highest number" << b << endl;
		else
			cout << "highest number" << c << endl;
}
void min (float a, float b, float c)
{
	if (a 
		if (a 
			cout << "The smallest number is" << a << endl;
		else
			cout << "The smallest number is" << c << endl;
	else
		if (b 
			cout << "The smallest number is" << b << endl;
		else
			cout << "The smallest number is" << c << endl;
}
void main ()
{
	float a, b, c;
	cout << "Please enter any number 3:" << endl;
	cin >> a;
	cin >> b;
	cin >> c;
	max (a, b, c);
	min (a, b, c);
}

No comments:

Post a Comment

Thanks