View previous topic :: View next topic |
Author |
Message |
TheWorks
Joined: 15 Oct 2004 Posts: 7
|
Posted: Sun Oct 17, 2004 9:10 pm Post subject: How to get the reminder of division in ASP? |
|
|
Hi,
I have 2 numbers in my ASP script and I want to get the reminder of the division between those 2 numbers. How do I do that in ASP (VBScript)? |
|
Back to top |
|
|
CarboN MaN
Joined: 13 Oct 2004 Posts: 6
|
Posted: Sun Oct 17, 2004 10:58 pm Post subject: |
|
|
try the following (copied from devguru)
Mod
The Mod operator divides two numbers and returns the remainder.
In the example, 5 divides into 26, 5 times, with a remainder of 1.
Code:
<% remainder = 26 Mod 5 %>
Output:
1
Note that for floating-point numbers, the numbers to the right of the decimal are rounded to the nearest integer (i.e., in the example, 5.7176 is treated as 6 by Mod).
Code:
<% remainder = 26.1234 Mod 5.7176 %>
Output:
2 |
|
Back to top |
|
|
TheWorks
Joined: 15 Oct 2004 Posts: 7
|
Posted: Sun Oct 17, 2004 11:22 pm Post subject: |
|
|
Thanks a lot!
That is exactly, what I was looking for! |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2002 phpBB Group
|