Line | Branch | Exec | Source |
---|---|---|---|
1 | /* | ||
2 | ** EPITECH PROJECT, 2023 | ||
3 | ** my_compute_power_rec_size_t | ||
4 | ** File description: | ||
5 | ** Returns the power (p) of the number (nb) in size_t | ||
6 | */ | ||
7 | /** | ||
8 | * @file my_compute_power_rec_size_t.c | ||
9 | * @brief The file containing the my_compute_power_rec_size_t function | ||
10 | * @author Nicolas TORO | ||
11 | */ | ||
12 | |||
13 | #include "my.h" | ||
14 | |||
15 | 4933 | size_t my_compute_power_rec_size_t(int nb, int p) | |
16 | { | ||
17 | size_t result; | ||
18 | |||
19 |
2/2✓ Branch 0 taken 4415 times.
✓ Branch 1 taken 518 times.
|
4933 | if (p > 0) { |
20 | 4415 | result = nb; | |
21 | 4415 | result = result * my_compute_power_rec_size_t(nb, p - 1); | |
22 |
2/2✓ Branch 0 taken 517 times.
✓ Branch 1 taken 1 times.
|
518 | } else if (p == 0) { |
23 | 517 | result = 1; | |
24 | } else { | ||
25 | 1 | result = 0; | |
26 | } | ||
27 | 4933 | return result; | |
28 | } | ||
29 |