Check out example codes for "pascal triangle c++". It will help you in understanding the concepts better.

Code Example 1

int pascal(int row, int col) {
  if (col == 0 || col == row) return 1;
  else if(col == 1 || (col + 1) == row) return row;
  else return pascal(row - 1, col - 1) + pascal(row - 1, col);
}

Learn ReactJs, React Native from akashmittal.com