--- title: "Math Flasher: Division" id: 57112 type: "computer_media" slug: "math-flasher-division" url: "http://localhost/computer_media/math-flasher-division/" markdown_url: "http://localhost/computer_media/math-flasher-division.md" published_at: "2024-10-03T23:41:05+00:00" modified_at: "2026-03-30T21:19:54+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2024/10/61_Div.png" excerpt: "A drill program that quizzes you on exact integer division, rejecting any problem that would produce a remainder before it ever appears on screen." 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: "Education" slug: "education" taxonomy: "genre" url: "http://localhost/type/education/" 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/61_Div.png" media_type_tags: "Education" --- # Math Flasher: Division Math Flasher 4 is a division drill program that generates random integer division problems with whole-number answers. It picks two single-digit numbers (0–9), rejecting zero divisors and any pair where P divided by Q is not an integer, ensuring clean division every time. After the user inputs an answer, the program displays CORRECT or WRONG in inverse video, then reveals the correct result before looping back for another problem. The header prints “DIVISION” followed by a row of eight asterisks as a simple visual separator. *** ## Program Analysis ### Program Structure The program is divided into clearly numbered functional blocks: 1. **Lines 5–60:** Header display — prints “DIVISION” and a row of eight asterisks as a separator. 2. **Lines 100–130:** Problem generation — picks random single-digit integers P and Q, filtering for valid, exact-division pairs. 3. **Lines 200–220:** Question display and answer input. 4. **Lines 300–410:** Answer checking and feedback. 5. **Lines 500–520:** Spacing and loop back to line 10 for the next problem. 6. **Lines 600–700:** SAVE and RUN utility lines at the end. ### Problem Generation Logic Lines 100–130 generate two values using `INT(10*RND)`, giving integers in the range 0–9. Two guards are applied: - `IF Q<1 THEN GOTO 110` — prevents division by zero by re-rolling Q only. - `IF P/Q<>INT(P/Q) THEN GOTO 100` — rejects non-integer quotients, restarting the entire pair so both P and Q are fresh. This means problems like 7÷3 are never presented. However, P can be zero, so “0 DIVIDE BY n” is a valid (trivially easy) problem. ### Key BASIC Idioms | Line | Idiom | Purpose | | --- | --- | --- | | `100` | `INT(10*RND)` | Generate integer 0–9 | | `130` | `P/Q <> INT(P/Q)` | Test for exact divisibility | | `310`, `400` | Inverse-video strings | Bold visual feedback (WRONG / CORRECT) | | `520` | `GOTO 10` | Infinite drill loop | ### Notable Techniques Feedback messages at lines 310 and 400 are rendered in inverse video characters, making WRONG and CORRECT stand out visually from the surrounding normal text. Line 410 always prints the correct answer regardless of whether the user was right or wrong, providing immediate reinforcement. The `CLS` at line 220 clears the screen immediately after input is entered, before any feedback is shown, keeping the display uncluttered. ### Bugs and Anomalies When the answer is wrong, execution falls through from line 310 to `GOTO 410` (line 320), which skips the CORRECT message and lands directly on the answer reveal — this is correct behaviour. However, there is a minor structural oddity: line 300 jumps to 400 on a correct answer, prints CORRECT, then falls through naturally to line 410, which prints the answer again. This means a correct answer causes the answer line to be printed immediately after the CORRECT message with no blank line between them, while a wrong answer gets a `GOTO 410` skip. The logic works but the numbering suggests the author considered adding more code between 400 and 410 that was never written. There is no mechanism to track score or count the number of questions attempted; the program loops indefinitely with no end condition. ## Source Code ``` 5 REM %M%A%T%H% %F%L%A%S%H%E%R% %4% %D%I%V%I%S%I%O%N 10 PRINT "DIVISION" 20 FOR L=1 TO 8 30 PRINT "*"; 40 NEXT L 50 PRINT 60 PRINT 100 LET P=INT (10*RND) 110 LET Q=INT (10*RND) 120 IF Q<1 THEN GOTO 110 130 IF P/Q<>INT (P/Q) THEN GOTO 100 200 PRINT "DIVIDE ";P;" BY ";Q 210 INPUT R 220 CLS 300 IF R=P/Q THEN GOTO 400 310 PRINT "%W%R%O%N%G" 320 GOTO 410 400 PRINT "%C%O%R%R%E%C%T" 410 PRINT P;" DIVIDED BY ";Q;" = ";P/Q 500 PRINT 510 PRINT 520 GOTO 10 600 SAVE "1006%1" 700 RUN ```