Pascal's triangle is a number pattern in the form of an array constructed by summing adjacent elements in preceding rows. Let's create them using a C++ program.
About Pascal's triangle:-
Pascal's triangle is a number pattern in the form of an array constructed by summing adjacent elements in preceding rows. The below diagram helps to understand what is pascal's triangle-
Let's create them using a C++ program. By using simple mathematical calculations & a logical mind we can create such a program easily.
How to use code:-
The code file is attached you can copy the code and paste it into your preferred IDE. Our suggestion will be to use VS Code.
How code is made:-
Firstly, the code will take input for rows. Then, the further program will run. An outer for-loop is used for rows. We have used 2 inner for-loops, one for spaces and the second for calculating numbers to be printed & to print.
Submitted by Akanksha Sharma (Akanksha)
Download packets of source code on Coders Packet
Comments