Periodic table: Difference between revisions
Content deleted Content added
→{{header|ASIC}}: Added. |
→{{header|Minimal BASIC}}: Added. |
||
Line 486:
{{out}}
<pre>Same as FreeBASIC entry.</pre>
=== {{header|Minimal BASIC}} ===
{{trans|Nascom BASIC}}
{{works with|Commodore BASIC|3.5}}
<lang gwbasic>
10 REM Periodic table
20 GOSUB 200
30 FOR J = 0 TO 9
40 READ N
50 GOSUB 400
60 NEXT J
70 END
190 REM Set arrays A, B.
200 DIM A(7), B(7)
210 FOR I = 0 TO 7
220 READ A(I)
230 NEXT I
240 FOR I = 0 TO 7
250 READ B(I)
260 NEXT I
270 RETURN
390 REM Show row and column for element
400 LET I = 7
410 IF A(I) <= N THEN 440
420 LET I = I-1
430 GOTO 410
440 LET M = N+B(I)
450 LET R = INT(M/18)+1
460 LET C = M-INT(M/18)*18+1
470 PRINT N; "->"; R; C
480 RETURN
990 REM Data.
1000 REM Arrays A, B.
1010 DATA 1, 2, 5, 13, 57, 72, 89, 104
1020 DATA -1, 15, 25, 35, 72, 21, 58, 7
1030 REM Example elements (atomic numbers).
1040 DATA 1, 2, 29, 42, 57, 58, 72, 89, 90, 103
</lang>
=== {{header|Nascom BASIC}} ===
|