24/02/2023

Calculates the Squares And Cubes of The Numbers in JavaScript

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


The Output Squares And Cubes in JavaScript
Previous Post
Next Post

post written by:

Hi, I’m Ghanendra Yadav, SEO Expert, Professional Blogger, Programmer, and UI Developer. Get a Solution of More Than 500+ Programming Problems, and Practice All Programs in C, C++, and Java Languages. Get a Competitive Website Solution also Ie. Hackerrank Solutions and Geeksforgeeks Solutions. If You Are Interested to Learn a C Programming Language and You Don't Have Experience in Any Programming, You Should Start with a C Programming Language, Read: List of Format Specifiers in C.
Follow Me

0 Comments: