Pascal's Triangle

M · mediumPracticematrixpattern-printing

Print Pascal’s Triangle for N rows.

Input
4
Output
1
1 1
1 2 1
1 3 3 1
Each row i: C(i,j) = C(i-1,j-1) + C(i-1,j). Print with leading spaces for formatting.
← Odd Occurring Element in O(log N)Pattern Printing (Right Triangle) →
Report an issue with this question