Append numbers at same position in strings: Difference between revisions

Append numbers at same position in strings in various BASIC dialents (BASIC256, Run BASIC and Yabasic)
m (Automated syntax highlighting fixup (second round - minor fixes))
(Append numbers at same position in strings in various BASIC dialents (BASIC256, Run BASIC and Yabasic))
Line 141:
}</syntaxhighlight>
{{out}}<pre>11019 21120 31221 41322 51423 61524 71625 81726 91827</pre>
 
 
=={{header|BASIC}}==
==={{header|BASIC256}}===
{{trans|FreeBASIC}}
<syntaxhighlight lang="BASIC256">arraybase 1
dim list1 = {1,2,3,4,5,6,7,8,9}
dim list2 = {10,11,12,13,14,15,16,17,18}
dim list3 = {19,20,21,22,23,24,25,26,27}
dim catlist(9)
 
for i = 1 to 9
temp$ = string(list1[i]) + string(list2[i]) + string(list3[i])
catlist[i] = FromRadix(temp$,10)
print catlist[i]; " ";
next i</syntaxhighlight>
{{out}}
<pre>Same as FreeBASIC entry.</pre>
 
 
==={{header|Run BASIC}}===
{{trans|FreeBASIC}}
<syntaxhighlight lang="lb">dim list1(9)
data 1,2,3,4,5,6,7,8,9
for i = 1 to 9
read list1(i)
next i
dim list2(9)
data 10,11,12,13,14,15,16,17,18
for i = 1 to 9
read list2(i)
next i
dim list3(9)
data 19,20,21,22,23,24,25,26,27
for i = 1 to 9
read list3(i)
next i
 
dim catlist(9)
for i = 1 to 9
temp$ = str$(list1(i)) + str$(list2(i)) + str$(list3(i))
catlist(i) = val(temp$)
print catlist(i); " ";
next i</syntaxhighlight>
{{out}}
<pre>Same as FreeBASIC entry.</pre>
 
 
==={{header|Yabasic}}===
{{trans|FreeBASIC}}
<syntaxhighlight lang="yabasic">// Rosetta Code problem: http://rosettacode.org/wiki/Append_numbers_at_same_position_in_strings
// by Jjuanhdez, 09/2022
 
dim list1(9)
data 1,2,3,4,5,6,7,8,9
for i = 1 to 9
read list1(i)
next i
dim list2(9)
data 10,11,12,13,14,15,16,17,18
for i = 1 to 9
read list2(i)
next i
dim list3(9)
data 19,20,21,22,23,24,25,26,27
for i = 1 to 9
read list3(i)
next i
 
dim catlist(9)
for i = 1 to 9
temp$ = str$(list1(i)) + str$(list2(i)) + str$(list3(i))
catlist(i) = val(temp$)
print catlist(i), " ";
next i</syntaxhighlight>
{{out}}
<pre>Same as FreeBASIC entry.</pre>
 
 
=={{header|CLU}}==
2,169

edits