Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The way to compute any given position’s value is to add up the numbers to the po

ID: 3636253 • Letter: T

Question

The way to compute any given position’s value is to add up the numbers to the position’s

right and left in the preceding row. For instance, to compute the middle number in the third

row, you add 1 and 1 (and to computer the third number in the fourth raw you add 2 and 1).

The sides of the triangle are always 1 because you only add the number to the upper left or

the upper right (there being no second number on the other side).

The program should prompt the user to input a row and a position in the row. The program

should ensure that the input is valid before computing a value for the position.

Function Pascal must be called by the main to do the computation.

Sample Input

4

2

Sample output

Value at row 4 and position 2 is 3

Explanation / Answer

#include long factorial(int); main() { int i, n, c; printf("Enter the number of rows you wish to see in pascal triangle "); scanf("%d",&n); for ( i = 0 ; i