Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com

Pascals Triangle

Moderate
0/80
3 upvotes
Asked in company
Inca Infotech Technologies Private Limited

Problem statement

Given an integer N, you need to print the Pascal's triangle.

Note : The values of pascal's triangle can be large, so take mod with 10^9 + 7.

For eg. N = 4

   1
  1 1
 1 2 1
1 3 3 1

You can read more about Pascal's triangle here

Detailed explanation ( Input/output format, Notes, Images )
Input Format :
Integer N
Output Format :
Pascals triangle in N lines
Constraints :

1 <= N <= 500

Sample Input :
6
Sample Output :
    1
   1 1
  1 2 1
 1 3 3 1
1 4 6 4 1
Full screen
Console