Pascal's Triangle - print a row
Anónimo
Any given row? So: // n is the row desired, and i'm assuming 1-index on rows, i.e. // the 1st row is 1, 2nd is 1, 1 rathere than 0th row is 1 void pascal(int a[ ], int size, int n) { n--; if(n == 0) { for(i = 0; i < size; i++) printf("%d", a[i]); return; } int b[size + 1]; b[0] = 1; b[size + 1] = 1; for(int i = 1; i < size; i++) b[i] = a[i - 1] + a[i]; pascal(b, size + 1, n); }