ASP Hosting sale!
Double disk space and transfer for FREE!
Limited time offer! Act Now!

aspdev | articles | tutorials | forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to get the reminder of division in ASP?

 
Post new topic   Reply to topic    ASPdev.org Forum Index -> ASP programming
View previous topic :: View next topic  
Author Message
TheWorks



Joined: 15 Oct 2004
Posts: 7

PostPosted: Sun Oct 17, 2004 9:10 pm    Post subject: How to get the reminder of division in ASP? Reply with quote

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
View user's profile Send private message
CarboN MaN



Joined: 13 Oct 2004
Posts: 6

PostPosted: Sun Oct 17, 2004 10:58 pm    Post subject: Reply with quote

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
View user's profile Send private message
TheWorks



Joined: 15 Oct 2004
Posts: 7

PostPosted: Sun Oct 17, 2004 11:22 pm    Post subject: Reply with quote

Thanks a lot!
That is exactly, what I was looking for!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    ASPdev.org Forum Index -> ASP programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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

SQL Tutorial