top of page

C Program to find nCr using Recursion

Writer's picture: Rajesh SinghRajesh Singh

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



245 views0 comments

Recent Posts

See All

IOT Sensor MCQ

Sensor MCQ for O level Exam: Q1. Which sensor is used in Mobile phones? A.      Capacitive Touch Sensor B.      Temperature Sensor...

IOT Arduino MCQ

Building IOT Applications MCQ: Q1. Which Microcontroller is used in Arduino UNO prototyping board? A.    ATmega328m B.     ATmega328p...

Commentaires


bottom of page