123456789101112131415161718192021222324
#include <iostream> #include <stdio.h> using namespace std; int main() { double sum = 0.0 ; unsigned count = 0; std::cout << "Enter a number\n" ; double value ; while ( std::cin >> value ) { sum += value ; ++count ; std::cout << "Enter a number\n" ; } std::cout << "Sum: " << sum ; std::cout << "\nCount: " << count ; std::cout << "\nAverage: " << sum/count << '\n' ; }