How to resolve the algorithm Sierpinski triangle step by step in the uBasic/4tH programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Sierpinski triangle step by step in the uBasic/4tH 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 uBasic/4tH programming language
Source code in the ubasic/4th programming language
Input "Triangle order: ";n
n = 2^n
For y = n - 1 To 0 Step -1
For i = 0 To y
Print " ";
Next
x = 0
For x = 0 Step 1 While ((x + y) < n)
If AND (x,y) Then
Print " ";
Else
Print "* ";
EndIf
Next
Print
Next
End
You may also check:How to resolve the algorithm Sort numbers lexicographically step by step in the jq programming language
You may also check:How to resolve the algorithm Yin and yang step by step in the Scala programming language
You may also check:How to resolve the algorithm Conditional structures step by step in the friendly interactive shell programming language
You may also check:How to resolve the algorithm Remove duplicate elements step by step in the Raven programming language
You may also check:How to resolve the algorithm Binary digits step by step in the CoffeeScript programming language