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
- Program to print a Hollow Triangle inside a Triangle
- Biggest Reuleaux Triangle inscribed within a Square inscribed in an equilateral triangle
- Program to calculate value of nCr
- C program to calculate the value of nPr
- Calculate the Discriminant Value
- Calculate the Sum of GCD over all subarrays
- Program to calculate the value of nCr Efficiently
- Program to Calculate e^x by Recursion
- Program to calculate the value of sin(x) and cos(x) using Expansion
- Write a program to calculate pow(x,n)
- Efficient program to calculate e^x
- Program to calculate Profit Or Loss
- Program to calculate GST from original and net prices
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.