Program TO PRINT the squares, roots, cubes and complements of integers between 1 and 100.

 PROGRAM.HTML

<html>

<body>

<script language="javascript">

var i;

var inp=parseInt(prompt("enter the end range value","3"));

document.write("no"+"&nbsp&nbsp&nbsp"+"square"+"&nbsp&nbsp&nbsp"+"squareroot"+"&nbsp&nbsp&nbsp"+"cube"+"&nbsp&nbsp&nbsp"+"        complement "+"<br>");

for(i=1;i<=inp;i++){

var sq=i*i;

var srt=Math.round(Math.sqrt(i));

var cu=i*i*i;

var comp=(-i);

document.writeln(i+"&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp"+sq+"&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp"+srt+"&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp"+cu+"&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp"+comp+"<br>");

}

</script>

</body>

</html>

OUTPUT



No comments:

Post a Comment