0
3.7kviews
Write a Java script to write out the multiplication table for the no. 5 from 1 to 20 using while loop.

Mumbai University > Information Technology > Sem 4 > Web Programming

Marks: 10M

Year: May 2015

1 Answer
0
7views
<html>
<head>
<script language="javascript">
// Use single-spaced text for Multiplication table
document.write("<h3 align='Center'>Multiplication Table</h3>");
document.write("<CENTER><BLOCKQUOTE><STRONG><PRE><FONT     COLOR='000080'>")
var i, j, total; // global variables
while ( i< = 5){
for (j = 1; j < 20; j++) {
total = i * j;
total = " " + total 
         ///add space before each number
         // Add another space before single digits
if (total < 10) total = " " + total;
     // Display result
document.write(total);
   } // end inner j loop
document.write("<BR>"); // end of line break
   } // end of i outer loop
document.write("</FONT></PRE></STRONG></BLOCKQUOTE></CENTER>");
</script>
</head>
<body>
</body>
</html>
Please log in to add an answer.