--- title: "Circumference" id: 56998 type: "computer_media" slug: "circumference" url: "http://localhost/computer_media/circumference/" markdown_url: "http://localhost/computer_media/circumference.md" published_at: "2024-10-02T07:18:54+00:00" modified_at: "2026-03-30T21:20:21+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2024/10/22_Cir.png" excerpt: "A short circle circumference calculator that uses the built-in PI constant and a fixed 35-foot diameter — with a few intriguing unreachable lines at the end." 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: "Mathematics" slug: "mathematics" taxonomy: "genre" url: "http://localhost/type/mathematics/" media_contents: - id: 56732 title: "Timex Sinclair Public Domain Library Tape 1001" type: "computer_media" url: "http://localhost/computer_media/timex-sinclair-public-domain-library-tape-1001/" media_type: "Program" mediadate: "198x" images: - url: "http://localhost/wp-content/uploads/2024/10/22_Cir.png" media_type_tags: "Mathematics" --- This program calculates the circumference of a circle with a fixed diameter of 35 feet using the formula C = π × D. It uses the built-in PI constant, storing it in variable P before performing the multiplication. The result is printed with a label and unit suffix. Lines 65–80 appear to be utility lines for saving and listing the program rather than part of the normal execution flow, which halts at line 60 with STOP. *** ## Program Analysis ### Program Structure The program is linear and brief, executing from line 20 through line 60 in sequence. Lines 65–80 are never reached during normal execution due to the `STOP` at line 60. | Line(s) | Purpose | | --- | --- | | 5–6 | REM comments describing program purpose and usage hint | | 20 | Assigns built-in `PI` constant to variable `P` | | 30 | Sets diameter `D` to 35 (feet) | | 40 | Computes circumference `C = P * D` | | 50–55 | Prints label and result with unit | | 60 | `STOP` — halts execution | | 65 | `CLEAR` — unreachable during normal run | | 70 | `SAVE "1002%2"` — saves program; unreachable during normal run | | 80 | `LIST` — unreachable during normal run | ### Key BASIC Idioms - The use of `LET P=PI` stores the built-in `PI` keyword into a scalar variable. This is a common pattern to shorten repeated references, though `PI` is only used once here, making it redundant in practice. - The diameter is hard-coded at line 30 (`LET D=35`); the REM at line 6 suggests the author intended to make it user-enterable via `INPUT`, but this was never implemented. - Output is split across two `PRINT` statements (lines 50 and 55), the second using a semicolon to append the unit string directly after the numeric value. ### Notable Techniques Lines 65–80 form a developer utility block intended to be run manually after editing: `CLEAR` resets variables, `SAVE` preserves the program to tape, and `LIST` redisplays it. Placing these after a `STOP` is a common hobbyist practice to keep housekeeping commands in the listing without affecting program flow. ### Bugs and Anomalies - The REM at line 6 promises the ability to enter any diameter, but no `INPUT` statement exists — the diameter is permanently fixed at 35. - `LET P=PI` adds an unnecessary variable assignment since `PI` could be used directly in line 40 as `LET C=PI*D`. - The apostrophe in `CIRCLES` (line 50) is absent — it should read `CIRCLE'S` — though this is a cosmetic issue only. ## Source Code ``` 5 REM CIRCUMFERENCE SOLUTION 6 REM ENTER DIAMETER AS REQUIRED 20 LET P=PI 30 LET D=35 40 LET C=P*D 50 PRINT "THE CIRCLES CIRCUMFERENCE IS :" 55 PRINT C;" FEET." 60 STOP 65 CLEAR 70 SAVE "1002%2" 80 LIST ```