Написать программу, вычисляющую среднее арифметическое 5 чисел, введенных с клавиатуры.
Решение:
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #include “stdafx.h” #include <iostream> #include <math.h> using namespace std; int main() {setlocale(LC_ALL,“Rus”); double n, summ=0, col, chislo, sra; for (n=1; n<=5; n++) { cin>>chislo; summ+=chislo; } sra=summ/5; cout<<endl<<sra<<endl; system(“pause”); return 0; } |

