Function practice 4


Submit solution

Points: 1
Time limit: 1.0s
Memory limit: 64M

Author:
Problem type
Allowed languages
C, C++, Python3

This practice problem will require you to programme basic functions.

You are required to write a function that calculates the binomial coefficient given input \(n,k\).

\(f(n,k) = \frac{n!}{k!(n-k!)}\)

It is recommended that your functions are defined as follows (C++)

long long factorial(int x);
long long binomial(int n, int k);

It is recommended that your functions are defined as follows (Python)

def factorial(x):
    # do your stuff
def binomial(n, k):
    # do your stuff

Input Specification

The first line will contain a 2 integers \(n,k\) (\(1 < k < n < 20\)).

Output Specification

The output should contain one line, binomial coefficient for \(n, k\).

Sample Input

9 6

Sample Output

84

Comments

There are no comments at the moment.