This question already has an answer here:
- Catalan Numbers 47 answers
Write a function that calculates a row of the pascal triangle and returns the middle number, if there are 2 it should return their sum.
To be clear:
a) if the number inputted is odd then find then return the middle number of a row on the pascal triangle.
b) if the number inputted is even then find the two middle numbers of the row on the pascal triangle and sum the 2 numbers.
The nth row is using zero-based indicies. For numbers other than zero, this is the row which has its second number as the number inputted into the function.