top of page

C Program to find nCr using Recursion

C Program to find nCr:



#include<stdio.h>

#include<conio.h>

int fact(x)

{

int i, f=i;

for(i=1;i<=x;i++)

{

f=f*i;

}

return(f);

}

void main()

{

int n,r, A;

printf("Enter the no.: ");

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

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

printf(%d",A);

getch();

}

Output:

Enter the no.: 2 1

2



31 views0 comments

Recent Posts

See All

1. The output of the following code. string=”my name is x” for i in string: print(i,end=”,”) A. m,y,,n,a,m,e,,i,s,x, B. m,y,,n,a,m,e,,i,s,x C. my,name,is,x D. None Answer: (A) 2. What arit

1. What is the full form of IoT? A. Internet of Technology B. Incorporate of Things C. Internet of Things D. Incorporate of Technology Answer: C 2. How many numbers of the element

bottom of page