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



159 views0 comments

Recent Posts

See All

Java Script MCQ Questions

Q1. JavaScript was invented by W3- Group Hel Sinki Linux Brendan Eich None Ans: C Q2. Variable can hold which type of value at a time:- A.    Multiple B.     Single C.     Double D.    None Ans: B Q3.

Comments


bottom of page