Given 3 integer N,R and M. You task is to calculate NCR%M.
The first line of the input contains an integer T denoting the number of test cases.Then T test cases follow. Each test case consists of 3 integers N,R and M.
For each test case output a single integer representing the value of NCR%M
1<=M<=10^5 where M is a square free and the largest prime factor of M is <=50.
4 2 28681
3 1 43710
5 3 3655
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.