How to resolve the algorithm Sierpinski triangle step by step in the Action! programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Sierpinski triangle step by step in the Action! programming language

Table of Contents

Problem Statement

Produce an ASCII representation of a Sierpinski triangle of order   N.

The Sierpinski triangle of order   4   should look like this:

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Sierpinski triangle step by step in the Action! programming language

Source code in the action! programming language

PROC Main()
  BYTE x,y,size=[16]

  Graphics(0)
  PutE() PutE()

  y=size-1
  DO
    FOR x=1 TO y+2
    DO Put(' ) OD

    FOR x=0 TO size-y-1
    DO
      IF (x&y)=0 THEN
        Print("* ")
      ELSE
        Print("  ")
      FI
    OD
    PutE()

    IF y=0 THEN
      EXIT
    FI
    y==-1
  OD

  

You may also check:How to resolve the algorithm XML/Output step by step in the Python programming language
You may also check:How to resolve the algorithm Hello world/Standard error step by step in the Standard ML programming language
You may also check:How to resolve the algorithm Fractal tree step by step in the Java programming language
You may also check:How to resolve the algorithm Averages/Simple moving average step by step in the Factor programming language
You may also check:How to resolve the algorithm Ethiopian multiplication step by step in the S-BASIC programming language