How to resolve the algorithm FizzBuzz step by step in the Modula-3 programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm FizzBuzz step by step in the Modula-3 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 Modula-3 programming language

Source code in the modula-3 programming language

MODULE Fizzbuzz EXPORTS Main;

IMPORT IO;

BEGIN
   FOR i := 1 TO 100 DO 
      IF i MOD 15 = 0 THEN 
         IO.Put("FizzBuzz\n");
      ELSIF i MOD 5 = 0 THEN
         IO.Put("Buzz\n");
      ELSIF i MOD 3 = 0 THEN 
         IO.Put("Fizz\n");
      ELSE 
         IO.PutInt(i);
         IO.Put("\n");
      END;
   END;
END Fizzbuzz.

  

You may also check:How to resolve the algorithm Create a file step by step in the Blue programming language
You may also check:How to resolve the algorithm Ackermann function step by step in the ZED programming language
You may also check:How to resolve the algorithm Draw a sphere step by step in the Ol programming language
You may also check:How to resolve the algorithm Pythagorean triples step by step in the MATLAB / Octave programming language
You may also check:How to resolve the algorithm Rename a file step by step in the TUSCRIPT programming language