0

# Is there a way to calculate permutations and combinations?

Help me with a code that can calculate permutations and combinations of a given problem

2 Answers

+ 9

U can make your methods for calculating permutaion & combination
â make a method for calculating factorial
â for nCr , calculate n!/[(n-r)!.(r)!]
â for nPr , calculate n!/(n-r)!
//U can also calculate nPr first & then use it to calculate nCr
fast way to calculate combination :
â make use of formula nCr = (n/r). (n-1)C(r-1) & recursion

0

Thank you mam