what a Java script program to display multiplication table of any number up to 10
Answers
Multiplication Table
document.write(”);
function multiply() {
var col, row, answer, multiplier; //declare variabels
document.write(‘Multiplication Table’ + ”);
document.write(‘Refresh the browser to use a different table multiplier’ + ”);
multiplier = prompt(“Enter a Multiplication Table max multiplier, ie; 10 for 10×10”, “”)
multiplier = parseInt(multiplier); //parse the num to number
document.write(”); //setup the table
for( col = 1; col <= multiplier; col++) {
document.write('’ + ‘ ‘);
for( row=1; row <= multiplier; row++) {
answer = col * row; //multiply columns * rows, store in variable answer
document.write( '’ + ‘ ‘ + answer + ‘ ‘ + ”);
}
document.write(”);
}
document.write(”);
}
document.write(”);
window.onload = multiply;
Hope it helps u.