I need to write a code that will prompt the user for five integer numbers and then determine the product and sum of the values.
It needs to use an array to enter the values, use a for loop to display the numbers and product, a while loop to display numbers and their sum, and then an HTML line that will display "the sum of x y and z is: sum and the product of x y and z is: product". I have this so far, can anyone help me out?
var array = [1, 2, 3, 4, 5, 6],
s = 0,
p = 1,
i;
for (i = 0; i < array.length; i += 1) {
s += array[i];
p *= array[i];
}
console.log('Sum : '+s + ' Product : ' +p);
whileloop? Also, think about how you input information into a web page when you need to do it on someone else's page and then do some research on that. We are here to help, but we have guidelines for asking questions an d we expect that you'll do you research before posting.