Jump to content

# Getting remainder from a division problem.

## Recommended Posts

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

##### Share on other sites

```\$rmdr = Mod(22366435,20930)
MsgBox(0,0,\$rmdr)```

• 1

Monkey's are, like, natures humans.

#### Share this post

##### Share on other sites

**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

##### Share on other sites

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.

## 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

×

• Wiki

• Back

• Git