Answer to Question #159218 in C++ for mary

Question #159218

Minimum of N numbers


1
Expert's answer
2021-01-28T04:28:24-0500
#include <iostream>
#include <limits>
using namespace std;
int main()
{
	int min = numeric_limits< int >::max();
	int N;
	cout << "Enter the number N: ";
	cin >> N;
	int a;
	for (int i = 0; i < N; i++)
	{
		cout << "Enter a number: ";
		cin >> a;
		if (a < min)
		{
			min = a;
		}
	}
	cout << "The minimum is equal to: " << min << endl;
	return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog