write a javascript that calculates the squares and cubes of the numbers from 0 to 10 and outputs HTML text that displays the resulting values in an HTML table format. print a table of numbers from 5 to 15 and their squares and cubes using alert. XHTML Text That Displays The Resulting Values In An XHTML Table Format, As Follows: Number Square Cube
0 0 0
1 1 1
2 4 8
3 9 27
4 16 64
5 25 125
6 36 216
7 49 343
8 64 512
9 81 729
10 100 1000
Javascript That Calculates the Squares and Cubes of the Numbers from 0 to 10
<html>
<head>
<script>
document.write( "<table> <tr> <th>Number</th> <th>Square</th> <th>Cube</th> </tr>" )
for(var n=0; n<=10; n++)
{
document.write( "<tr><td>" + n + "</td><td>" + n*n + "</td><td>" + n*n*n + "</td></tr>" )
}
document.write( "</table>" )
</script>
</head>
</html>
The Output Squares And Cubes in JavaScript
0 Comments: