- 1

Input the amount of sales for 12 months of a medical representative and find the average sales value without using an array.

please... can you do???

20th Jul 2016, 3:12 PM
Akshay AK
Akshay AK - avatar
4 odpowiedzi
0
assuming you don't need the monthly values for further calculations. This would do int x=0, sum=0, avg=0, input=0; while(x<12) { cin >> input; sum += input; x++; } avg = sum / 12; cout << "average is:" << avg << endl;
20th Jul 2016, 3:46 PM
Steven
Steven - avatar
0
thanks
20th Jul 2016, 4:00 PM
Akshay AK
Akshay AK - avatar
0
if you have to print the decimal digits as well. you should define avg as float.
20th Jul 2016, 4:14 PM
Steven
Steven - avatar
0
mm
20th Jul 2016, 4:17 PM
Akshay AK
Akshay AK - avatar