+ 1

HELP !! JavaScript

My assignment is: Write a program that asks the user for some positive integers. The program will start by asking the user to enter in how many numbers then want to enter. The program should the ask for all the numbers and then output the division between the biggest number entered and the smallest number entered. Here is what I have so far (please note this is merely a rough outline): count=0 read n loop until i=0 read i count=count+i end loop avg=count/n print avg I am still confused on how to go about the biggest and smallest numbers. Any insight would be greatly appreciated!

11th Dec 2018, 2:28 PM
Tay
2 Réponses
+ 8
Hello, 😊 Please, if you want us to help you, then show us your attempt, what you don't understand exactly, where you are struggling, it will be much easier!👍😉 Use the search bar! https://www.sololearn.com/post/10362/?ref=app Please, read our guidelines: https://www.sololearn.com/discuss/1316935/?ref=app An useful code for any new user here!;) https://code.sololearn.com/WvG0MJq2dQ6y/
11th Dec 2018, 4:00 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 2
var n = prompt("Enter a number"); n = parseInt(n); var numArray = []; for(var i=0;i<n;i++) { numArray[i] = parseInt(prompt("Enter number at index "+i)); } var max = Math.max(...numArray); var min = Math.min(...numArray); console.log(max+"/"+min+" = "+max/min);
11th Dec 2018, 3:02 PM
Rishi Anand
Rishi Anand - avatar