Given the following recursive function signature write the r

Given the following recursive function signature, write the recursive function that takes a row and a column and finds the value at that position in the triangle. Assume that the triangle starts at row 0 and column 0. Examples: pascal(2, 1) -> 2 pascal(1, 2) -> 0

Solution

Pascal\'s triangle conatins Binomial coefficients P(n,k) and which could be calculated using belwo recursive formula

P(n,k) = P(n-1,k-1)+ P(n-1,k)

Now let us implement this formula in our progra and no specific language is expected hence i am writing in C++

#include<iostream.h>

#include<conio.h>

#include<stdio.h>

int pascal(int p, int q)

{

}

void main()

{

cout<<\"Please enter the row number\";

cin>>row;

cout<<\"Please enter the colum number\";

cin>col;

for(int n = 0;i<row;i++)

{

for(int k= 0;k<=n;k++)

{

value = pascal(n,k);

}

}

}

Given the following recursive function signature, write the recursive function that takes a row and a column and finds the value at that position in the triangl

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site