+ 1

Design and implemen

Design and implement a program that Asks the user to enter a series of numbers and stores numbers in the array. The series is of arbitrary size. Each time the user enters the number the program asks whether the user wants to enter one more number. Doubles every third number in the series. Stores the resulting series either in the same array or in a new one. Example: series 3 2 4 5 6 7 8 becomes 3 2 8 5 6 14 8. Outputs both the original and the modified arrays. function () { var numbers[10]; for(i=0;i<numbers.count;i++) { document.write("do you want enter one more number"); var number= prompt(enter the number); if((i+1)%3==0) { numbers[i]=number*2; } else{ numbers[i]=number; } document.write(" Can you please press Y if you want to enter one more number"); var YesorNo =prompt(enter the Y or N); if(YesorNo !="Y") what else is missing?

28th Aug 2018, 6:39 AM
gobins e
gobins e - avatar
1 Answer
0
The array must be dynamic sized, but it's always reduced to hold 10 numbers. Also, it's better to handle the prompting with a cycle.
16th Mar 2020, 3:53 PM
Eduard Arias
Eduard Arias - avatar