Input: n = 5, r = 3
n! / r! * (n – r)! = 5! / 3! * (2!) = 120 / 12 = 10
Input: n = 7, r = 2
Approach: The idea is to store the Pascal’s triangle in a matrix then the value of nCr will be the value of the cell at nth row and rth column.
Below is the implementation of the above approach:
- Program to calculate the Area and Perimeter of Incircle of an Equilateral Triangle
- Biggest Reuleaux Triangle within a Square which is inscribed within a Right angle Triangle
- Biggest Reuleaux Triangle inscribed within a Square inscribed in an equilateral triangle
- Program to calculate value of nCr
- Calculate the Discriminant Value
- C program to calculate the value of nPr
- Program to calculate the value of sin(x) and cos(x)
- Program to calculate the value of nCr Efficiently
- Efficient program to calculate e^x
- Write a program to calculate pow(x,n)
- Calculate area of pentagon with given diagonal
- Program to calculate GST from original and net prices
- Calculate speed, distance and time
- Program to calculate distance between two points in 3 D
- Program to calculate Profit Or Loss
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.