Write a code that displays the result of multiplying numbers from 1 to 10 by 5.
What am I doing wrong?
var x = 5; var y = 1; var z = x * y; while (z <= 50) { document.write(x + "x" + y + "=" + z + "<br>"); y++; } Write a code that displays the result of multiplying numbers from 1 to 10 by 5.
What am I doing wrong?
var x = 5; var y = 1; var z = x * y; while (z <= 50) { document.write(x + "x" + y + "=" + z + "<br>"); y++; } It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:
var x = 5, y = 1, z; while (z < 50) { z = x * y; document.write(x + "x" + y + "=" + z + "<br>"); y++; } But, judging by the task, the result of the multiplication is not known in advance, therefore it is more correct to check not by the result, but by the value of the variable that will be multiplied:
var x = 5, y = 1; while (y <= 10) { z = x * y; document.write(x + "x" + y + "=" + z + "<br>"); y++; } var z = ""; ? why even a string? - Grundyz checked. When checking y variable z is not needed at all - GrundyWrite a code that displays the result of multiplying numbers from 1 to 10 by 5
By assignment it is clear that you need to withdraw 1 * 5.2 * 5.3 * 5 ... 10 * 5.
var i = 0; while(i<10){ i++; console.log(i*5); } If I understand the condition correctly then so :)
var i =1; while (i<11){ console.log(i*5); i++ } The output will be in the browser console
Source: https://ru.stackoverflow.com/questions/580101/
All Articles
zmove inside the loop. - Visman