# Permutations Program

**Background**

Permutations are the number of possible orders for a given group of elements. You can determine the permutation by multiplying by the number of possible choices for each selection.

For example, let's say you are given 4 distinct elements, and want to know how many ways you can arrange 3 of them. You can pick from 4 elements for the first choice, 3 for the second, and 2 for the third:

4 Permute 3 = 4 * 3 * 2 = 24 possible ways

(See below for additional examples.)

**Challenge Formula**

The general Permutation formula for *a permute b* is:

a * (a-1) * (a-2)... (until you've multiplied *b* elements.)

Can you calculate *a* permute *b*?

### Challenge

Given two numbers `a`

and `b`

, calculate and return `a`

Permute `b`

as above.

Please sign in or sign up to submit answers.

Alternatively, you can try out Learneroo before signing up.

## Comments

## 許友誠

May 15, 5:06 AMimport java.util.Scanner;

public class Main {

}

## thales

Jul 16, 12:19 PMmy code

## Bolke

Sep 25, 6:24 AMThat was tricky. Took me! my code