Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

testing division rest

Status
Not open for further replies.

rbauerle

Programmer
Oct 16, 2001
48
BR
How can I test if the rest of a division is zero?
For example:
6/3=2 rest=0 or 6/4=1 rest=2

Thanks a lot
 
You need the modulus operator, which in most languages is
%
but for some reason, MS decided to make it
mod

so:
6 mod 3 = 0

and

6 mod 2 = 0

but

6 mod 4 = 2

good luck! :)
paul
penny1.gif
penny1.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top