Jump to content
Sign in to follow this  
OneManPen

Getting remainder from a division problem.

Recommended Posts

OneManPen

I'm writing a small bit of code for a large project. What it does, is gets the remainder left over from a division problem... for example 223/200 and it will give you 23. I wrote a working program... but if I use large numbers it fails... e.g. 4561698 .It seems to fail on $calc3 = $calc1 - $calc2. I see no logical reason why it's doing this... So thanks in advance for any help.

$input = InputBox("Input a random number", "Input any random number")
$input2 = InputBox("Input the number to divide it by", "Input any number to divide it by")
If $input < $input2 Then
MsgBox(0, "Cannot divide", "This program cannot calculate this remainder")
Exit
EndIf
$calc1 = $input / $input2
$calc2 = Int($calc1)
$calc3 = $calc1 - $calc2
$calc3 = $calc3 * $input2
MsgBox(0, "Result", $calc3)

Share this post


Link to post
Share on other sites
OneManPen

**EDIT**

Ah... I see, I couldn't find it when I was looking through the help file :) I guess I need to learn how to look harder.

Edited by SleeperCell42

Share this post


Link to post
Share on other sites
Xandy

Ah... I see, I couldn't find it when I was looking through the help file :) I guess I need to learn how to look harder.

There are times when given all the information, we're right back at square one, wondering where to look. I find myself there again from time to time.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×