Example Math Code 1

The following program shows the use of Math.round ( )

<html>
<head>
<script type='text/javascript'>

var Number ;

Number = 9.1 ;
Number = Math.round(Number)  ; // Will round the number down to 9
alert (Number) ;

Number = 9.9 ;
Number = Math.round(Number) ; // Will round the number up to 10
alert (Number) ;

</script>
</head>
<body>
</body>
</html>

Example Math Code 2