SQL PHP HTML ASP JavaScript articles and free scripts to download
 

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.


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
Sections
PHP
JavaScript
ASP
HTML
SQL
Photoshop
Articles SEO
All ASP Tutorials
ASP Sections
Ajax
Date and time
Declaring array
Form in ASP
Server.MapPath
Date Time & MSSQL
Select Query
File System Object
String Functions
Popular Tutorials
Managing two drop downs
Subscribe
Submit your email address and receive article and product notifications. Your email is safe with us.