vendredi 27 février 2015

How to make a simple 5 line JavaScript Multiplication table for loop


Vote count:

0




I am currently struggling on this project, as I have no idea what goes where and through the various searches online, I get different answers so the code I have currently have most likely is no where near correct. The multiplication table goes 1 - 10 and shows multiplication answers up to 5. (1x1 = 1, 1x2 = 2, all the way up to 5x10, if that makes sense) I need a correct example of my code.





<!DOCTYPE html>
<html>
<head>
<title>Multiplication Tables</title>
</head>
<body>
<p>Enter a number below to see its multiplication table.</p>
<input type="text" name="txtNumber" id="txtNumber" placeholder="Enter a number" />
<br />
<br />

<button onclick="DisplayTable();">Click Me</button>
<div id="multiTable"></div>

<script language="javascript">
function DisplayTable(){
for (var i = 1; i <= 10; i++){
for (var i = 1, var j = 0; (i+j) <= 10; i++, j += i) {
System.out.print("\t"+i*j);
System.out.println();
}
}
}
</script>

</body>
</html>




asked 1 min ago







How to make a simple 5 line JavaScript Multiplication table for loop

Aucun commentaire:

Enregistrer un commentaire