answersLogoWhite

0


Best Answer

#include<stdio.h>

int fact(int);

void main()

{

int n,r,f;

printf("enter value for n & r\n");

scanf("%d%d",&n,&r);

if(n<r)

printf("invalid input");

else

f=fact(n)/(fact(n-r)*fact(r));

printf("binomial coefficient=%d",f);

}

int fact(int x)

{

if(x>1)

return x*fact(x-1);

else

return 1;

}

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

12y ago

#include<stdio.h>

#include<conio.h>

int bin_cof(int n, int r)

{

if(r==0 r==n) return 1;

if(r<0 r>n n<0) return 0;

return bin_cof(n-1, r) + bin_cof(n-1, r-1);

}

void main()

{

int n,r;

printf("Enter the value of n\n");

scanf("%d", &n);

printf("Enter the value of r\n");

scanf("%d", &r);

printf("Binomial Co-efficient (%d %d) = %d", n,r,bin_cof(n,r));

}

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

Write a non-recursive first, then transform the iteration into recursion.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How t write Recursive C program to find Binomial coefficient?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Why recursive solution is better for tree traversal?

Because a tree is a recursive data-structure. It's easier to write (and easier to understand) a recursive program for handling it.


Jntu 2-2 oops through java answers?

write a java program to find factorial using recursive and non recursive


How do you write a binomial distribution table in C program?

Class&amp;genus


Write a c program to find GCD of two given integers by using both recursive n non recursive functions?

i love u darling


How do you write a binomial c program?

#include&lt;stdio.h&gt; int fact(int); void main() { int n,r,f; printf("enter value for n &amp; r\n"); scanf("%d%d",&amp;n,&amp;r); if(n&lt;r) printf("invalid input"); else f=fact(n)/(fact(n-r)*fact(r)); printf("binomial coefficient=%d",f); } int fact(int x) { if(x&gt;1) return x*fact(x-1); else return 1; }


How do you write scientific classification?

Binomial nomenclature ( the generic and then the specific name)


To correctly write the binomial nomenclature for a particular animal?

A binomial nomenclature is the two name system of naming living things used in classification. The currently used binomial nomenclature was developed by Linneus.


How do you write the numerical coefficient of 3axy?

It is 3.


What is the correct way to write the binomial scientific name for red maple?

The correct binomial scientific name for red maple is Acer rubrum.


How can you solve the tower of hanoi?

1. Write mathematical analysis for recursive algorithms. Solve Tower of Hanoi Problem and analyze it.


How do you write a recursive Formula?

3,6,9,12 A sub 1 = First (3) a sub n = a sub (n-1) + change (3)


Write and explain recursive backtracking algorithm for n-queens?

This is not a question, this is your homework. For a start, read this: https://en.wikipedia.org/wiki/Eight_queens_puzzle