ASP Math Function
Math functions are part of our ASP scripts. Mostly they are used within the applications and support the script with various features. We will discuss some common functions used frequently inside our code.
Int function to get Integer part
From any number we can get the integer part only by using int function . Here are some values returned by int function.
Int ( 4.0 ) will return 4
Int ( 4.1 ) will return 4
Int ( 4.9 ) will return 4
Int ( 4.5 ) will return 4
Int ( 1.1 ) will return 1
Int ( 0 ) will return 0
Int ( -0.1 ) will return -1
Int ( -2.1 ) will return -3
Int ( -2.9 ) will return -3
Mod function to get the reminder of division
We can get the reminder after a division is by using mod function. Here is the code
Dim my_num1,my_num2
my_num1=50
my_num2=10
Response.Write my_num1 mod my_num2
The output of above line is 0. If we change the value of my_num1 to 55 then the output will change to 5.
This article is written by plus2net.com team.
Be the first to post comment on this article :
plus2net.com
|