Formula for Success
Michael Dunn
Hebburn, Tyne and Wear
Your Computer, February 1982, page 75


This short routine runs on the 1K basic machine and calculates empirical chem-
ical formulae from experimental data.

First, you are asked to input, the number of elements in the compound. Then, in
response to the prompt "Type data". You must type the symbol, relative atomic 
mass and percentage of the element present in the compound, from each element 
in turn.

The computer will then calculate the simplest formula from these inputs and 
print it out,  with the ratios of atoms in brackets correct to two decimal 
places. The program can handle up to 10 elements. Press Newline to process an-
other set of data.

The data is stored in three arrays A$(), A(), and B() and is input and process-
ed via two loops. Line 105 prints out the empirical formula rounding down to 
two decimal places.