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

57 lines
630 B
Plaintext

rem uses carry command to perform modulus
rem compiles with FTCBASIC to 545 bytes com file
define e = 0, i = 0, m = 0, r = 0, c = 0, q = 0
dim a[1, 2, 5, 13, 57, 72, 89, 104]
dim b[-1, 15, 25, 35, 72, 21, 58, 7]
do
cls
print "Periodic Table Lookup"
print "0 to continue or 1 to quit: " \
input q
if q = 0 then
gosub searchtable
endif
pause
loop q <> 1
end
sub searchtable
print "Atomic number: " \
input e
let i = 8
do
let i = i - 1
loop @a[i] > e
let m = e + @b[i]
let r = m / 18
carry c
let r = r + 1
let c = c + 1
print "Period: " \
print r \
print " Group: " \
print c \
return