ASP percentage value by using FormatPercent function

We can get the percentage of two numbers by using ASP function FormatPercent(). We can use this function to get the percentage and we can format the output as per our requirement. Here is the syntax of FormatPercent function.

FormatPercent(n1/n2,d3)

Here n1 and n2 are two variables and d3 is the number specifying number of decimal places required. d3 is an optional value we can specify as the number of decimal places we want. Default value for this is 2.

Here is an example of FormatPercent function.

Dim my_num
my_num=FormatPercent(11/203,6) ' Output is 5.418719%
Response.Write my_num

one more example without using optional value for decimal places

Dim my_num
my_num=FormatPercent(11/203) ' Output is 5.42%
Response.Write my_num

Be the first to post comment on this article :





Further readings
Round function to format decimal place in a number
Math functions INT
Random Number generator using Random function
Percentage value by using FormatPerecnt function

Post your comments , suggestion , error , requirements etc here .




We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2019 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer