nPr
Submissions: 7956   Accuracy:

35.17%

  Difficulty: School   Marks: 0
*School Problem's Submission isn't counted in score!
Associated Course(s):   Interview Preparation
       

Write a program to calculate nPrnPr represents n permutation r and value of nPr is (n!) / (n-r)!.

Input: 
The first line of the input contains T denoting the number of testcases. T testcases follow. First line of the test case will be the value of n and r respectively.

Output:
For each test case, in a new line, output will be the value of nPr.

Constraints:
1 <= T <= 100
1 <= n,r <= 20
n >= r

Example:
Input:
2
2 1
10 4

Output:
2
5040

 

** For More Input/Output Examples Use 'Expected Output' option **

Author: atharv


Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.