Press "Enter" to skip to content

Math Example in JavaScript

Last updated on October 5, 2019

Definition:

It is an object of java script which is meant for providing variables and functions for performing mathematical functions on the web page.

Program :

<html>

  <head>

     <script language=”javascript”>

             function display()

             {

               document.write(Math.PI+”</br>”);

               document.write(Math.E+”</br>”);

               document.write(Math.sin(90)+”</br>”);

               document.write(Math.asin(90)+”</br>”);

               document.write(Math.sqrt(25)+”</br>”);

               document.write(Math.pow(2,4)+”</br>”);

               document.write(Math.abs(-25)+”</br>”);

               document.write(Math.ceil(10.45)+”</br>”);

               document.write(Math.floor(10.45)+”</br>”);

               document.write(Math.round(10.45)+”</br>”);

               document.write(Math.max(10,20)+”</br>”);

               document.write(Math.min(10,20)+”</br>”);

               document.write(Math.random()+”</br>”);

             }

             </script>

             </head>

             <body>

               <input type=”button” value=”getdata” onClick=”display()”/> </br>

             </body>

</html>

Be First to Comment

    Leave a Reply

    Your email address will not be published. Required fields are marked *