Trying to come up with something other than what's been posted...
Code: (Select All)
FOR i = 5 TO -7 STEP -1
PRINT i, modx(i, 5)
NEXT
FUNCTION modx (i, j)
IF SGN(i) < 0 THEN
IF ABS(i) <> ABS(j) THEN modx = (ABS(j) - ABS(i MOD j)) ELSE modx = 0
ELSE
modx = i MOD j
END IF
END FUNCTION