memberlogin
contactus
randomfacts

Arithmetic using vbscript

First let\'s look at addition - pretty straight forward. This will write to the browser: Your total is 6.

<%

myint1 = 2

myint2 = 4

mytotal = myint1 + myint2

Response.write "Your total is: "&mytotal

%>

Now subtraction, this will write to the browser: Your total is -2.

<%

myint1 = 2

myint2 = 4

mytotal = myint1 - myint2

Response.write "Your total is: "&mytotal

%>

Now multiplication, this will write to the browser: Your total is 8.

<%

myint1 = 2

myint2 = 4

mytotal = myint1 * myint2

Response.write "Your total is: "&mytotal

%>

Now division, this will write to the browser: Your total is .5.

<%

myint1 = 2

myint2 = 4

mytotal = myint1 / myint2

Response.write "Your total is: "&mytotal

%>

Finally Modulus, which will give you the remainder when you divide two numbers. Your total is 1.

<%

myint1 = 5

myint2 = 4

mytotal = myint1 / myint2

Response.write "Your total is: "&mytotal

%