Hàm làm tròn VBScript
❮ Tham khảo VBScript hoàn chỉnh
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 |
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
Hiển thị ví dụ »Ví dụ 2
Cách làm tròn 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
Hiển thị ví dụ »❮ Tham khảo VBScript hoàn chỉnh