You are on page 1of 1

1 #include <iostream>

2 // a program to compute sum and average of 10 times


3 using namespace std;
4
5 int main()
6 {
7 //Declaring required variable
8 double num;
9 double sum =0;
10 double avg;
11 // prompte the user to enter 10 numbers
12 cout << "enter 10 numbers of choice" << endl;
13 for(int i =1;i<=10;i++)
14 {
15 cin >> num;
16 sum = sum +num; //sum +=num
17 }
18 avg =sum/10;
19 cout << "the sum is:" <<sum << endl;
20 cout <<"the average is:" <<avg<<endl;
21
22 return 0;
23 }

You might also like