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



 
 
 

Recent Posts

See All
NIELIT CCC MCQ Questions with Answers

Q1. Which protocol is used to upload and download file? (A) TCP (B) HTTP (C) FTP (D) SMTP Ans: C Q2. How many is Number of digits in a Visa Card number? (A) 15 (B) 16 (C) 18 (D) 19 Ans: B Q3. What is

 
 
 
IT Tools and Network Basics MCQ

Q1. Presentation file created in LibreOffice Impress is saved with the extension….   लिब्रे ऑफिस इंप्रेस में बनाई गई प्रेजेंटेशन फ़ाइल एक्सटेंशन के साथ सेव की जाती है .ods .odt .ott .odp Ans: D Q2. So

 
 
 

Comments


bottom of page