This post has been moved to my new blog: Read Full Post

Skip to content
# JavaScript code to display Multiplication table

##
6 thoughts on “JavaScript code to display Multiplication table”

### Leave a Reply

This post has been moved to my new blog: Read Full Post

%d bloggers like this:

Reblogged this on johnwdriscoll.

LikeLike

nice very usefull

LikeLike

the above code is not a true multiplication table, it’s simply showing the multiples of the number you type. Below would be a true multiplication table:

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;

LikeLike

thank you it useful for us

LikeLike

Need ouput ,where is Output screenshot

LikeLike

i want 1 to 10 tables to display

LikeLike