How to resolve the algorithm Catalan numbers/Pascal's triangle step by step in the Run BASIC programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Catalan numbers/Pascal's triangle step by step in the Run BASIC programming language

Table of Contents

Problem Statement

Print out the first   15   Catalan numbers by extracting them from Pascal's triangle.

Pascal's triangle

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Catalan numbers/Pascal's triangle step by step in the Run BASIC programming language

Source code in the run programming language

n = 15
dim t(n+2)
t(1) = 1
for i = 1 to n
  for  j = i to 1 step -1  : t(j) = t(j) + t(j-1): next j
  t(i+1) = t(i)
  for  j = i+1 to 1 step -1: t(j) = t(j) + t(j-1 : next j
print t(i+1) - t(i);" ";
next i

  

You may also check:How to resolve the algorithm Arithmetic evaluation step by step in the Nim programming language
You may also check:How to resolve the algorithm Sort an integer array step by step in the GAP programming language
You may also check:How to resolve the algorithm Factorial base numbers indexing permutations of a collection step by step in the AppleScript programming language
You may also check:How to resolve the algorithm Summarize and say sequence step by step in the Aime programming language
You may also check:How to resolve the algorithm The Twelve Days of Christmas step by step in the Sidef programming language