+ 1

what is happening in this simple attempt to write a code that prints a user-inputted number, multiplied by numbers up to 12

//this is what I wrote: var z = prompt("enter a number to find its multiplication table"); var end = z*12; for (; z<=end; z+=z) { document.write(z + " "); } /*how would you write a code that would multiply the number from the user by the numbers 1 to 12, and print each one? (i.e. 5 10 15 20 25 30 etc.)*/

12th Aug 2018, 2:52 AM
Tyler M
Tyler M - avatar
1 Resposta
+ 3
var z = prompt("enter a number to find its multiplication table"); for (var i = 1; i <= 12; i++) { document.write(z*i + " "); }
12th Aug 2018, 3:18 AM
Eduardo Petry
Eduardo Petry - avatar