Hi,
This is an exercise I solved it, I want to know, is my solve is the best solve or there is notes, if there is a notes, I'm glade to hear it:
The Exercise:
Make a program that calculates the sum, mean, minimum, and maximum of a series of numbers.
Example:
numbers: 10, 12, 10, 14
The sum is 46,
the mean is 11.5,
the minimum is 10,
the maximum is 14.
My solve:
#include <iostream>
using namespace std;
void main()
{
float sum, mean, minimum, maximum;
float numbers[4]={10,12,10,14};
sum=numbers[0]+numbers[1]+numbers[2]+numbers[3];
cout << "Sum = " << sum << endl;
mean=sum/4;
cout << "Mean = " << mean << endl;
}
how can I find minimum and maximum from array?