بيان المشكلة
In this challenge, you will generate and print the first N rows of Pascal's Triangle.
What is Pascal's Triangle?
Pascal's Triangle is a triangular array of numbers where:
- The first row contains only the number
1. - Each subsequent row begins and ends with
1, and each interior number is the sum of the two numbers directly above it from the previous row.
Your Task
Write a program that:
- Reads an integer N from input.
- Prints the first N rows of Pascal's Triangle.
- Each row should contain numbers separated by spaces.
- Each row should be printed on a new line.
Hint compute each value using the binomial coefficient formula:
value = value * (row - j) / (j + 1);