Here is the question:

Write a program that outputs the following Pascal triangle using two nested for loops.


1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
1 6 15 20 15 6 1
1 7 21 35 35 21 7 1
1 8 28 56 70 56 28 8 1

Note that for a given row i and a given column j, the value in the triangle

Where both rows and columns start at 0. Therefore, starting with P(i, 0) = 1, we can compute the rest of the entries of the ith row. Implement this idea using loops.

tab[0][1]=1
for (int i =2; i<=n; i++)
	for (int j=1; j<=i; j++)
		tab[i-1][j]=tab[i-2][j]+tab[i-2][j-1]