Answer to Question #162894 in C++ for manoj

Question #162894

write a program to read a sorted list of floating point values and then calculate and display the average of the values


1
Expert's answer
2021-02-11T16:58:16-0500
#include <iostream>

using namespace std;

int main()
{
	int count;
	cout << "How much floats you want to calculate? ";
	cin >> count;
	double float_tmp, floats_sum = 0;
	cout << "Enter your floats:\n";
	for (int i = 0; i < count; ++i)
	{
		cin >> float_tmp;
		floats_sum += float_tmp;
	}
	cout << "\nThe average value is " << floats_sum / count;
}

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