How to resolve the algorithm FizzBuzz step by step in the ZX Spectrum Basic programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm FizzBuzz step by step in the ZX Spectrum Basic programming language

Table of Contents

Problem Statement

Write a program that prints the integers from   1   to   100   (inclusive).

But:

The   FizzBuzz   problem was presented as the lowest level of comprehension required to illustrate adequacy.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm FizzBuzz step by step in the ZX Spectrum Basic programming language

Source code in the zx programming language

10 DEF FN m(a,b)=a-INT (a/b)*b
20 FOR a=1 TO 100
30 LET o$=""
40 IF FN m(a,3)=0 THEN LET o$="Fizz"
50 IF FN m(a,5)=0 THEN LET o$=o$+"Buzz"
60 IF o$="" THEN LET o$=STR$ a
70 PRINT o$
80 NEXT a

  

You may also check:How to resolve the algorithm Shoelace formula for polygonal area step by step in the 11l programming language
You may also check:How to resolve the algorithm Apply a callback to an array step by step in the Sparkling programming language
You may also check:How to resolve the algorithm Count occurrences of a substring step by step in the Red programming language
You may also check:How to resolve the algorithm Sorting algorithms/Sleep sort step by step in the PHP programming language
You may also check:How to resolve the algorithm Determine if a string has all the same characters step by step in the Lambdatalk programming language