RosettaCodeData/Task/Loops-With-multiple-ranges/BASIC256/loops-with-multiple-ranges....

24 lines
631 B
Plaintext

global sum, prod
subroutine process(x)
sum += abs(x)
if abs(prod) < (2 ^ 27) and x <> 0 then prod *= x
end subroutine
prod = 1
sum = 0
x = 5 : y = -5 : z = -2
one = 1 : three = 3 : seven = 7
for j = -three to (3 ^ 3) step three: call process(j): next j
for j = -seven to seven step x: call process(j): next j
for j = 555 to 550 - y: call process(j): next j
for j = 22 to -28 step -three: call process(j): next j
for j = 1927 to 1939: call process(j): next j
for j = x to y step z: call process(j): next j
for j = (11 ^ x) to (11 ^ x) + one: call process(j): next j
print " sum= "; int(sum)
print "prod= "; int(prod)
end