Среднее значение округляется до целого(дробная часть отсекается)
#include <iostream>using std::cout;using std::cin;using std::endl;int main(){ int a[10]; int sum = 0; cout << "Enter the growth of ten people:" << endl; for(int i = 0; i < 10; i++) { cin >> a[i]; sum += a[i]; } cout << "\nThe total growth of all people equal to " << sum << "sm" << "\nThe average growth of all people equal to " << (sum / 10) << "sm" << endl; return 0;}
Среднее значение округляется до целого(дробная часть отсекается)
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
int main()
{
int a[10];
int sum = 0;
cout << "Enter the growth of ten people:" << endl;
for(int i = 0; i < 10; i++)
{
cin >> a[i];
sum += a[i];
}
cout << "\nThe total growth of all people equal to " << sum << "sm"
<< "\nThe average growth of all people equal to " << (sum / 10) << "sm" << endl;
return 0;
}