Created
August 5, 2012 16:46
-
-
Save jpatel3/3265860 to your computer and use it in GitHub Desktop.
JavaScript Multiplication
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>10*10 Multiplication Matrix</title> | |
</head> | |
<body> | |
<table border="2" cellspacing="0" > | |
<script language="javascript"> | |
//Width | |
x=10 | |
//Height | |
y=10 | |
//Use prompt on above if you want dynmic | |
//Loop through height | |
for( i=0; i<=y; i++) | |
{ | |
document.write("<tr>"); | |
for( j=0; j<=x; j++) | |
{ | |
//First row | |
if(i == 0) | |
document.write("<th>"+j+"</th>"); | |
//first column | |
else if(j == 0) | |
document.write("<th>"+i+"</th>"); | |
//Multiplication | |
else | |
document.write("<th>"+(i*j)+"</th>"); | |
} | |
document.write("</tr>"); | |
} | |
</script> | |
</table> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment