| | |
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
| |
|
|
|