--- title: "Financial Ratios" id: 57169 type: "computer_media" slug: "financial-ratios" url: "http://localhost/computer_media/financial-ratios/" markdown_url: "http://localhost/computer_media/financial-ratios.md" published_at: "2024-10-04T01:12:46+00:00" modified_at: "2026-03-30T21:19:15+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2024/10/118_FiRa.png" excerpt: "A complete 18-ratio financial analysis tool that walks you through 23 accounting inputs and prints a neatly aligned balance-sheet and profitability report." category: - name: "Archived Media" slug: "archived-media" taxonomy: "category" url: "http://localhost/category/archived-media/" post_tag: - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" - name: "TS 1000" slug: "ts1000" taxonomy: "post_tag" url: "http://localhost/tag/ts1000/" model: - name: "Timex/Sinclair 1000" slug: "ts-1000" taxonomy: "model" url: "http://localhost/model/ts-1000/" genre: - name: "Finance" slug: "finance" taxonomy: "genre" url: "http://localhost/type/finance/" media_contents: - id: 56733 title: "Timex Sinclair Public Domain Library Tape 1002" type: "computer_media" url: "http://localhost/computer_media/timex-sinclair-public-domain-library-tape-1002/" media_type: "Program" mediadate: "198x" images: - url: "http://localhost/wp-content/uploads/2024/10/118_FiRa.png" media_type_tags: "Finance" --- # Financial Ratios This program is a financial ratio calculator that collects up to 23 accounting inputs (sales, cost of goods sold, net income, assets, liabilities, equity, and share data) via sequential INPUT statements and then computes 18 standard financial ratios. Ratios calculated include working capital, current ratio, acid test, accounts receivable and inventory turnover, gross profit rate, return on assets and equity, leverage ratios, book value, earnings per share, and price-to-earnings ratio. Rounding is handled throughout using the classic INT(x * scale + 0.5) / scale idiom rather than any built-in rounding function. Results are printed in a columnar layout using TAB(25) alignment for the values alongside TAB(1) labels on the left. *** ## Program Analysis ### Program Structure The program is divided into four logical phases, separated by REM statements: 1. **Header (lines 1–3):** Title display. 2. **Data entry (lines 10–242):** Sequential PRINT/INPUT/PRINT triplets collect 23 values. 3. **Calculations (lines 250–420):** All 18 ratios are computed and stored in lettered variables (`A1`–`Q1`). 4. **Output (lines 500–800):** Results printed in a two-column layout; program halts at `STOP`. ### Input Variables | Variable | Meaning | | --- | --- | | `A$` | Date string | | `B` | Sales | | `C` | Cost of goods sold | | `D` | Net income | | `E` | Cash | | `F` | Accounts receivable (current year-end) | | `G` | Accounts receivable (prior year-end) | | `H` | Inventory (current year-end) | | `I` | Inventory (prior year-end) | | `J` | Other current assets | | `K` | Land/buildings/equipment (gross) | | `L` | Accumulated depreciation | | `M` | Other assets | | `N` | Total assets (prior year-end) | | `O` | Current liabilities | | `P` | Long-term debt | | `Q` | Other liabilities | | `R` | Preferred stock | | `S` | Common stock | | `T` | Retained earnings | | `U` | Stockholders’ equity (prior year-end) | | `V` | Market value of common stock | | `W` | Shares of common stock outstanding | | `X` | Preferred stock dividends | ### Computed Ratios | Variable | Ratio | Formula summary | | --- | --- | --- | | `A1` | Working capital | E+F+H+J−O | | `B1` | Current ratio | (E+F+H+J)/O, 2 d.p. | | `C1` | Acid test | (E+F)/O, 2 d.p. | | `D1` | A/R turnover | B / avg(F,G), 1 d.p. | | `E1` | Avg days sales in A/R | F / (B/300), integer | | `F1` | Inventory turnover | C / avg(H,I), 1 d.p. | | `G1` | Days sales in inventory | H / (C/300), integer | | `H1` | Gross profit rate (%) | (B−C)/B × 100, 1 d.p. | | `I1` | Net profit : avg assets (%) | D / avg total assets × 100, 1 d.p. | | `J1` | Net profit : net worth (%) | D / avg equity × 100, 1 d.p. | | `K1` | Net worth : liabilities | (R+S+T)/(O+P+Q), 2 d.p. | | `L1` | Fixed assets : long-term debt | (K−L)/P, 2 d.p. | | `M1` | Net worth : fixed assets | (R+S+T)/(K−L), 2 d.p. | | `N1` | Fixed assets depreciated (%) | L/K × 100, integer | | `O1` | Book value per share | (S+T)/W, 2 d.p. | | `P1` | Earnings per share | (D−X)/W, 2 d.p. | | `Q1` | P/E ratio | V/P1, 1 d.p. | ### Notable Techniques All rounding uses the classic `INT(x * scale + 0.5) / scale` idiom. For example, to round to two decimal places: `INT(value * 100 + .5) / 100`; for one decimal place the multiplier is 10; for percentage integers the division is omitted. This is the standard technique in the absence of a built-in rounding function. The days-sales calculations at lines `300` and `320` divide by `B/300` and `C/300` respectively, implicitly assuming a 300-day business year (common in financial analysis) rather than 365 days. Echo-printing each input immediately after entry (e.g. lines `22`, `32`, …) serves as a manual verification step, allowing the user to spot keying errors before proceeding to the next field. Output alignment is achieved entirely with `TAB(25)` for all numeric results and `TAB(1)` for labels, producing a clean two-column display. Blank `PRINT` lines at lines `645`, `675`, `705`, `735`, `765`, and `785` group related ratios visually. ### Potential Issues and Anomalies - **Division by zero risk:** Several ratios will crash with a division-by-zero error if the user enters zero for current liabilities (`O`), long-term debt (`P`), shares outstanding (`W`), or if EPS (`P1`) resolves to zero before the P/E calculation at line `420`. No error trapping is present. - **Net worth formula inconsistency:** Ratios `K1`, `L1`, and `M1` define net worth as `R+S+T` (preferred + common + retained earnings), which excludes preferred stock from equity in some formulations — this is a common but debatable accounting convention in such programs. - **Book value excludes preferred stock:**`O1` computes `(S+T)/W`, omitting preferred stock (`R`) from the numerator, giving common equity book value per share specifically rather than total equity book value. - **Lines 810–820 are unreachable:** The `STOP` at line `800` halts execution; lines `810` (`SAVE`) and `820` (`RUN`) can only be reached by direct command or by manually entering their line numbers. - **Variable naming collision risk:** The use of single-letter variables `A`–`W` for inputs alongside two-character variables `A1`–`Q1` for results is clear in context but leaves no room for expansion without renaming. ## Source Code ``` 1 REM FINANCIAL RATIO 2 PRINT TAB (10);"FINANCIAL RATIOS" 3 PRINT 10 PRINT "ENTER DATE" 11 INPUT A$ 12 PRINT A$ 20 PRINT "ENTER SALES" 21 INPUT B 22 PRINT B 30 PRINT "ENTER COST OF GOODS SOLD" 31 INPUT C 32 PRINT C 40 PRINT "ENTER NET INCOME" 41 INPUT D 42 PRINT D 50 PRINT "ENTER CASH" 51 INPUT E 52 PRINT E 60 PRINT "ENTER AR(CURRENT Y/E)" 61 INPUT F 62 PRINT F 70 PRINT "ENTER AR(PRIOR Y/E)" 71 INPUT G 72 PRINT G 80 PRINT "ENTER INVENTORY(CURRENT Y/E)" 81 INPUT H 82 PRINT H 90 PRINT "ENTER INVENTORY(PRIOR Y/E)" 91 INPUT I 92 PRINT I 100 PRINT "ENTER OTHER CURRENT ASSETS" 101 INPUT J 102 PRINT J 110 PRINT "ENTER VALUE,LAND/BLDGS/EQUIP" 111 INPUT K 112 PRINT K 120 PRINT "ENTER ACCUMULATED DEPRECIATION" 121 INPUT L 122 PRINT L 130 PRINT "ENTER OTHER ASSETS" 131 INPUT M 132 PRINT M 140 PRINT "ENTER TOTAL ASSETS(PRIOR Y/E)" 141 INPUT N 142 PRINT N 150 PRINT "ENTER CURRENT LIABILITIES" 151 INPUT O 152 PRINT O 160 PRINT "ENTER LONG TERM DEBT" 161 INPUT P 162 PRINT P 170 PRINT "ENTER OTHER LIABILITIES" 171 INPUT Q 172 PRINT Q 180 PRINT "ENTER PREFERRED STOCK" 181 INPUT R 182 PRINT R 190 PRINT "ENTER COMMON STOCK" 191 INPUT S 192 PRINT S 200 PRINT "ENTER RETAINED EARNINGS" 201 INPUT T 202 PRINT T 210 PRINT "ENTER STKHLDRS EQUITY(PRIOR Y/E)" 211 INPUT U 212 PRINT U 220 PRINT "ENTER MARKET VALUE COMMON STOCK" 221 INPUT V 222 PRINT V 230 PRINT "ENTER SHARES OF COMMON OUTSTANDING" 231 INPUT W 232 PRINT W 240 PRINT "ENTER PREFERRED STOCK DIVIDENDS" 241 INPUT X 242 PRINT X 250 REM CALCULATE ANSWERS 260 LET A1=E+F+H+J-O 270 LET B1=INT (((E+F+H+J)/O)*100+.5)/100 280 LET C1=INT (((E+F)/O)*100+.5)/100 290 LET D1=INT (B/((F+G)/2)*10+.5)/10 300 LET E1=INT (F/(B/300)) 310 LET F1=INT (C/((H+I)/2)*10+.5)/10 320 LET G1=INT (H/(C/300)) 330 LET H1=INT ((B-C)/B*1000+.5)/10 340 LET I1=INT (D/((E+F+H+J+K-L+M+N)/2)*1000+.5)/10 350 LET J1=INT (D/((R+S+T+U)/2)*1000+.5)/10 360 LET K1=INT ((R+S+T)/(O+P+Q)*100+.5)/100 370 LET L1=INT ((K-L)/P*100+.5)/100 380 LET M1=INT ((R+S+T)/(K-L)*100+.5)/100 390 LET N1=INT (L/K*100+.5) 400 LET O1=INT ((S+T)/W*100+.5)/100 410 LET P1=INT ((D-X)/W*100+.5)/100 420 LET Q1=INT ((V/P1)*10+.5)/10 500 REM PRINT ALL ANSWERS 510 PRINT 520 PRINT 600 PRINT TAB (25);A$ 610 PRINT 620 PRINT TAB (1);"WORKING CAPITAL";TAB (25);A1 630 PRINT TAB (1);"CURRENT RATIO";TAB (25);B1 640 PRINT TAB (1);"ACID TEST";TAB (25);C1 645 PRINT 650 PRINT TAB (1);"A/R TURN";TAB (25);D1 660 PRINT TAB (1);"AVG.DAYS SLS IN A/R(Y/E)";TAB (25);E1 670 PRINT TAB (1);"INV TURN";TAB (25);F1 675 PRINT 680 PRINT TAB (1);"NR DAYS SLS IN INV(Y/E)";TAB (25);G1 690 PRINT TAB (1);"GROSS PROFIT RATE";TAB (25);H1 700 PRINT TAB (1);"NET PROFIT:AVG ASSETS";TAB (25);I1 705 PRINT 710 PRINT TAB (1);"NET PROFIT:NET WORTH";TAB (25);J1 720 PRINT TAB (1);"NET WORTH:LIAB";TAB (25);K1 730 PRINT TAB (1);"FIXED ASSETS:L.T.D.";TAB (25);L1 735 PRINT 740 PRINT TAB (1);"NET WORTH:FIXED ASSETS";TAB (25);M1 750 PRINT TAB (1);"FIXED ASSETS DEPRCIATED";TAB (25);N1 760 PRINT TAB (1);"BOOK VALUE";TAB (25);O1 765 PRINT 770 PRINT TAB (1);"EARNINGS PER SHARE";TAB (25);P1 780 PRINT TAB (1);"P/E RATIO";TAB (25);Q1 785 PRINT 800 STOP 810 SAVE "1011%8" 820 RUN ```