How to resolve the algorithm FizzBuzz step by step in the Egel programming language

Published on 12 May 2024 09:40 PM

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

Source code in the egel programming language

import "prelude.eg"
import "io.ego"

using System
using IO

def fizzbuzz =
    [ 100 -> print "100\n"
    | N -> 
        if and ((N%3) == 0) ((N%5) == 0) then 
            let _ = print "fizz buzz, " in fizzbuzz (N+1)
        else if (N%3) == 0 then
            let _ = print "fizz, " in fizzbuzz (N+1)
        else if (N%5) == 0 then
            let _ = print "buzz, " in fizzbuzz (N+1)
        else
            let _ = print N ", " in fizzbuzz (N+1) ]

def main = fizzbuzz 1

  

You may also check:How to resolve the algorithm Modular inverse step by step in the Rust programming language
You may also check:How to resolve the algorithm Long primes step by step in the Rust programming language
You may also check:How to resolve the algorithm Digital root step by step in the Wortel programming language
You may also check:How to resolve the algorithm Greatest element of a list step by step in the MontiLang programming language
You may also check:How to resolve the algorithm Hash join step by step in the C# programming language