最近评论
正在载入评论列表...
![]() |
![]() |
int = Math.floor(n);
int = Math.ceil(n);
其中n为要进行取整操作的数。

<html>
<head>
<title>取整函数的使用</title>
</head>
<body>
<script language="javascript">
<!--
n = prompt("请输入一个要取整的数:");
|
int = Math.floor(n);
|
int = Math.ceil(n);
}
document.write(n,"的整数为:",int);
//-->
</script>
</body>
</html>

图1.30