Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
56
Task/Periodic-table/FTCBASIC/periodic-table.basic
Normal file
56
Task/Periodic-table/FTCBASIC/periodic-table.basic
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue