Doubt in friends problem

sir what is the formula for ncr or can i get code for problem

hi @tejasddongare
nC2 = n! / ((n-2)!*2!) = n*(n-1)/2
You can use this formula for nCr where r = 2