RosettaCodeData/Task/Periodic-table/QBasic/periodic-table.basic

33 lines
618 B
Plaintext

SUB MostarPos (N)
DIM a(7)
RESTORE a:
FOR x = 0 TO 7: READ a(x): NEXT x
DIM b(7)
RESTORE b:
FOR x = 0 TO 7: READ b(x): NEXT x
I = 7
WHILE a(I) > N
I = I - 1
WEND
M = N + b(I)
R = (M \ 18) + 1
C = (M MOD 18) + 1
PRINT USING "Atomic number ### -> #_, ##"; N; R; C
END SUB
DIM Element(0 TO 12)
RESTORE elements
elements:
DATA 1, 2, 29, 42, 57, 58, 59, 71, 72, 89, 90, 103, 113
FOR x = 0 TO 12: READ Element(x): NEXT x
FOR I = 0 TO UBOUND(Element)
MostarPos (Element(I))
NEXT I
a:
DATA 1, 2, 5, 13, 57, 72, 89, 104
b:
DATA -1, 15, 25, 35, 72, 21, 58, 7