Loops/With multiple ranges: Difference between revisions

Loops/With multiple ranges en BASIC256
(Loops/With multiple ranges en FreeBASIC)
(Loops/With multiple ranges en BASIC256)
Line 659:
<pre>sum = 348,173
prod = -793,618,560</pre>
 
 
=={{header|BASIC256}}==
{{trans|FreeBASIC}}
<lang BASIC256>
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
</lang>
 
 
=={{header|C}}==
2,130

edits