a = 500
b = 1000
c = 1500
val = 2000
if val >= c then
MaxLoop = (val \ c)
elseif val >= b then
MaxLoop = (val \ b)
elseif val >= a then
MaxLoop = (val \ a)
else
MaxLoop = 0
end if
for i =1 to MaxLoop +1
if val >= c then
val = val - c
getval = val
elseif val >= b then
val = val - b
getval = val
elseif val >= a then
val = val - a
getval = val
else
getval = val
exit for
end if
next
response.write "<br>a = "& getval
response.write "<br>b = "
response.write "<br>c = "