Friday, October 17, 2014

Write A program to use of Math Function in javascript.


Write A program to use of Math Function in javascript.
Code : mathfun.html

<html>
<head>
<style type="text/css">
.body
{
color:blue;
font-size:30px;
}
</style>
<script type="text/javascript">
var num1=16.7;
var num2=3;
var num3=121;
</script>
</head>
<body class="body">
<script type="text/javascript">
document.write("ceil() : Returns rounded greater integer number : ");
document.write(Math.ceil(num1) + " and ");
document.write(Math.ceil(-5.12));
document.write("<br>floor() : Returns rounded lower integer number : ");
document.write(Math.floor(num1) + " and ");
document.write(Math.floor(-5.12));
document.write("<br>abs() : Returns an absolute value : ");
document.write(Math.abs(num1) + " and ");
document.write(Math.abs(-7));
document.write("<br>round() : Returns nearest integer number : ");
document.write(Math.round(num1) + " and ");
document.write(Math.round(-5.6));
document.write("<br>Max() : Returns the highest value from two values : ");
document.write(Math.max(num1,num2) + " and ");
document.write(Math.max(10,12));
document.write("<br>Min() : Returns the lowest value from two values : ");
document.write(Math.min(num1,num2) + " and ");
document.write(Math.min(10,12));
</script>
</body>
</html>

No comments: