Average of 5 inputed numbers | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Average of 5 inputed numbers

explain me how.

8th Aug 2018, 12:05 PM
Maria Antonette Duran
Maria Antonette Duran - avatar
4 Answers
+ 2
thank you hinanawi 😊😘
8th Aug 2018, 12:12 PM
Maria Antonette Duran
Maria Antonette Duran - avatar
+ 1
put this inside main(): int a, sum; for(int i = 0; i < 5; i++) { cin >> a; sum += a; } cout << (sum / 5.0);
8th Aug 2018, 12:08 PM
hinanawi
hinanawi - avatar
+ 1
can't understand this, can you explain me how you can do that?
8th Aug 2018, 12:10 PM
Maria Antonette Duran
Maria Antonette Duran - avatar
+ 1
Maria Antonette Duran well, this code lets you input 5 numbers, and adds them all into one sum, then divides that by 5. that's how you get the average of the 5 numbers
8th Aug 2018, 12:11 PM
hinanawi
hinanawi - avatar