DumbQuesionGuy314
DumbQuesionGuy314

Reputation: 173

How to make a modulus series in Visual Basic?

For my problem I need to figure out how to make the remainder of a modulus division problem continue into another calculation in visual basic. It is really difficult to word, so I will try to use an example:

The user enters 4500. 4500 mod 1000 = 4 times with a remainder of 500.

Now I need the 500 to continue into the next calculation.

500 mod 100 = 5

Then the output may read: Boxes of 1000: 4 Boxes of 100: 5

Can anyone explain how I would code a problem similar to this in Visual Basic?

Upvotes: 0

Views: 4923

Answers (1)

Shmiddty
Shmiddty

Reputation: 13967

Dim dividend As Integer = 4500/1000         ' results to 4
Dim remainder As Integer = 4500 Mod 1000    ' results to 500
Dim subdividend As Integer = remainder/100  ' results to 5

Upvotes: 1

Related Questions