- 1

Average of 5 inputed numbers

explain me how.

8th Aug 2018, 12:05 PM
Maria Antonette Duran
Maria Antonette Duran - avatar
4 Réponses
+ 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