top of page
Writer's pictureRajesh Singh

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



209 views0 comments

Recent Posts

See All

Files MCQ in Python

File Processing MCQ Q1. Which function writes a list of lines in File? A.      Writelines() B.      Write() C.      Tell() D.      All of...

Python List MCQ Questions

Q1. What is output of below python code? dict= {1:'1', 2:'2', 3:'3'} del dict[1] dict[1] = '10' del dict[2] print (len(dict)) A. 1 B. 2...

Comments


bottom of page