Chức năng vòng VBScript
❮ Toàn bộ tài liệu tham khảo VBScript
Hàm Round làm tròn một số.
Cú pháp
Round(expression[,numdecimalplaces])
Parameter | Description |
---|---|
expression | Required. The numeric expression to be rounded |
numdecimalplaces | Optional. Specifies how many places to the right of the decimal are included in the rounding. Default is 0 |
Các ví dụ
ví dụ 1
<%
response.write(Round(24.13278) & "<br />")
response.write(Round(24.75122))
%>
Đầu ra của đoạn mã trên sẽ là:
24
25
Ví dụ 2
Cách làm tròn một số, giữ nguyên 2 số thập phân:
<%
response.write(Round(24.13278,2))
%>
Đầu ra của đoạn mã trên sẽ là:
24.13
❮ Toàn bộ tài liệu tham khảo VBScript