# Designing Functions

Create the prototypes of some functions in C++.

In this lesson, weâ€™ll look at some functions and decide on their prototypes. Weâ€™ll be looking at what should be the inputs and outputs of these functions, without discussing the internal details (that we will discuss in the upcoming lessons).

## Some examples of designing functions

Letâ€™s look at some example functions and their respective prototypes.

### Factorial computation

**Factorial** is a mathematical quantity that measures the number of possible ordered arrangements.
This is shown below:

$n! = n \times (n-1) \times (n-2) \times ... \times 2 \times 1$

For example, the factorial of 5 is calculated as **$5 \times 4 \times 3 \times 2 \times 1 = 120$**.

From this definition, we can see that both the input and output of this function should be integers because, when we multiply integers, we get an integer. The image of the factorial function as a black box (without focusing on the actual code implementation of the function) can be seen below.

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy