
how to find square and cube of five number

Hi Friend,
Try the following code:
<html>
<script>
document.writeln("Square of 5 numbers:<br><br>");
var i;
for(i=1;i<=5;i++){
document.writeln(i+" "+(i*i)+"<br>");
}
document.writeln("Cube of 5 numbers:<br><br>");
var j;
for(j=1;j<=5;j++){
document.writeln(j+" "+(j*j*j)+"<br>");
}
</script>
</html>
Thanks
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.