# 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

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.

Alternatively, you can try out Learneroo before signing up.

• #### 許友誠

import java.util.Scanner;

public class Main {

``````static int doStuff(int a, int b)
{
int count=b;
int  ans=1;

for(int i=0;i<b;i++)
``````
• #### thales

my code

• #### Bolke

That was tricky. Took me! my code