The above animation is produced in C# programming language for students who do computer science at GCSE, IGCSE, IB and A Level.
The code snippet consists of four major function that collectively produce the Pascal's Triangle.
They are:
- A factorial function
- A function to generate combinations
- A function to generate Pascal's Triangle in the correct format
- The main function to run the function in step 3).
The code snippet is given below; you can practise it interactively by providing the function, Pascal's Triangle(n), the parameter required - the number of rows.
Since the formatting is programmed up to 10 rows, please use a number below 10.
0 comments:
Post a Comment