An assignment with
whileloops.
In a file called number-summer.js file, write a program that continually prompts the user for numbers greater than 0 until the user enters a 0 at which point the sum of all the inputted numbers is logged out.
Enter some numbers (type 0 when complete):
> 20
> 10
> 3.2
> 0
Those numbers sum to 33.2
Write a program that prompts the user for a number, then repeatedly doubles that number until it is greater than or equal to 100.
Enter a number:
> 23
23
46
92
184
Write a program that takes a string and 'repeats it' until the string's length is greater than or equal to 10.
Enter a string:
> abc
abc
abcabc
abcabcabc
abcabcabcabc
Enter a string:
> a
a
aa
aaa
aaaa
aaaaa
aaaaaa
aaaaaaa
aaaaaaaa
aaaaaaaaa
aaaaaaaaaa
Write a program that prompts the user for two numberx, x and y. The program should add one to x until it is divisble by y.
Enter x:
> 9
Enter y:
> 1
9 is divisible by 1
Enter x:
> 9
Enter y:
> 2
9
10 is divisible by 2
Enter x:
> 10
Enter y:
> 3
10
11
12 is divisible by 3
Enter x:
> 5
Enter y:
> 4
5
6
7
8 is divisible by 4
Write a program, fibonacci.js that accepts a number, n, from the user and consequently logs the first n values in the fibonacci sequence.
The fibonacci sequence starts with 0 then 1. Each subsequent value can be obtained by summing the previous two values:
0 1 1 2 3 5 8 13 21 34 ...
Enter a value for "n":
> 9
0
1
1
2
3
5
8
13
21