Circumference

This file is part of Timex Sinclair Public Domain Library Tape 1001 . Download the collection to get this file.
Date: 198x
Type: Program
Platform(s): TS 1000

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–6REM comments describing program purpose and usage hint
20Assigns built-in PI constant to variable P
30Sets diameter D to 35 (feet)
40Computes circumference C = P * D
50–55Prints label and result with unit
60STOP — halts execution
65CLEAR — unreachable during normal run
70SAVE "1002%2" — saves program; unreachable during normal run
80LIST — 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.

Content

Appears On

Assembled by Tim Ward from many sources. Contains programs 10001 – 10050.

Related Products

Related Articles

Related Content

Image Gallery

Circumference

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 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top