QuestionAsk Questions?

1)print the positive equivalent of the number 2) check if the no is integer or not 3) find the square root of the number 4) find the cube of the number

View Answers

March 12, 2011 at 12:53 PM

<html> <script> function check(){ var n=document.getElementById("num").value; if(!isNaN(n)){ alert("Entered value is integer!"); } else{ alert("Entered value is not an integer!"); } var num=parseInt(n); alert("Square root of a number: "+Math.sqrt(num)); var cube=num*num*num; alert("Cube of a number: "+cube); } </script> Enter Number<input type="text" id="num"><input type="button" value="Check" onclick="check();"> </html>

Related Tutorials/Questions & Answers: