0

HELP PLIS

It is an exercise given by my teacher and I really don't know how to do it. We have to use the for loop and do it in JavaScript. I appreciate any help you can offer me. ♡. Write a program that allows entering 10 numbers and obtain the following results. Note: You should not use 10 different variables; you can reuse the same variable. - The total sum of all entered numbers - The average of all entered numbers

7th Jun 2024, 8:11 PM
Agustina Vega
Agustina Vega - avatar
2 ответов
+ 6
make a variable to store the sum, initialize it with 0. make a for-loop that iterates 10 times. on each iteration, get input. convert each input to a number and add it to the sum-variable. the average is the sum divided by 10.
7th Jun 2024, 8:54 PM
Lisa
Lisa - avatar
+ 5
Lisa you're the best, I over looked the important part it requires input. Good catch!
7th Jun 2024, 9:05 PM
Chris Coder
Chris Coder - avatar