How to resolve the algorithm Floyd's triangle step by step in the BCPL programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Floyd's triangle step by step in the BCPL programming language
Table of Contents
Problem Statement
Floyd's triangle lists the natural numbers in a right triangle aligned to the left where
The first few lines of a Floyd triangle looks like this:
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Floyd's triangle step by step in the BCPL programming language
Source code in the bcpl programming language
get "libhdr"
let width(n) = n<10 -> 1, 1 + width(n/10)
let floyd(rows) be
$( let maxno = rows * (rows+1)/2
let num = 1
for r = 1 to rows
$( for c = 1 to r
$( writed(num, 1 + width(maxno-rows+c))
num := num + 1
$)
wrch('*N')
$)
$)
let start() be
$( floyd(5)
wrch('*N')
floyd(14)
$)
You may also check:How to resolve the algorithm Pythagorean triples step by step in the Scala programming language
You may also check:How to resolve the algorithm Factors of a Mersenne number step by step in the 11l programming language
You may also check:How to resolve the algorithm String append step by step in the Lang programming language
You may also check:How to resolve the algorithm MAC vendor lookup step by step in the Julia programming language
You may also check:How to resolve the algorithm Long literals, with continuations step by step in the Kotlin programming language