Loops/With multiple ranges: Difference between revisions
Content added Content deleted
(Applesoft BASIC) |
(Added uBasic/4tH version) |
||
Line 2,678: | Line 2,678: | ||
=={{header|uBasic/4tH}}== |
|||
{{trans|FreeBASIC}} |
|||
<lang>p = 1 ' product |
|||
s = 0 ' sum |
|||
x = 5 |
|||
y = -5 |
|||
z = -2 |
|||
o = 1 ' one |
|||
t = 3 ' three |
|||
v = 7 ' seVen |
|||
For j = -t To (3 ^ 3) Step t: Proc _Process(j) : Next |
|||
For j = -v To v Step x: Proc _Process(j) : Next |
|||
For j = 555 To 550 - y: Proc _Process(j) : Next |
|||
For j = 22 To -28 Step -t: Proc _Process(j) : Next |
|||
For j = 1927 To 1939: Proc _Process(j) : Next |
|||
For j = x To y Step z: Proc _Process(j) : Next |
|||
For j = (11 ^ x) To (11 ^ x) + o: Proc _Process(j) : Next |
|||
Print Using " sum= +###,###"; s |
|||
Print Using "prod= +###,###,###"; p |
|||
End |
|||
_Process |
|||
Param (1) |
|||
s = s + Abs(a@) |
|||
If (Abs(p) < (2 ^ 27)) * (a@ # 0) Then p = p * a@ |
|||
Return</lang> |
|||
{{out}} |
|||
<pre> sum= 348,173 |
|||
prod= -793,618,560 |
|||
0 OK, 0:537</pre> |
|||
=={{header|Vala}}== |
=={{header|Vala}}== |
||
<lang vala>const int CHARBIT = 8; |
<lang vala>const int CHARBIT = 8; |