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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MODULUS Assignment 1

Status
Not open for further replies.

hankm3

Programmer
Jan 27, 2002
284
US
Hello,

I need to divide a number and get the remainder using the Modulus Assignment operator. % or %= but have not been able to get it to work. Anyone use this operator.

Thanks
 
Knob

Got part of it to work:

integer A = 20
integer B = 101
integer Sum, Mod

Sum = B \ A
Sum equals 5

Mod = B % A
Mod equals 1

Never got the %= to work.

Thanks

 
The way %= works is that the remainder will be placed in the variable that held the value being divided. In other words, you can't use %= with a third variable. In your case above, you would use B %= A to replace the Mod = B % A line, but then you would use your original value in B.


aspect@aspectscripting.com
 
Thanks Knob,

That was the Trick I needed for the %= Expression.

Hank
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top