| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | ** EPITECH PROJECT, 2023 | ||
| 3 | ** my_compute_power_rec | ||
| 4 | ** File description: | ||
| 5 | ** Returns the power (p) of the number (nb) | ||
| 6 | */ | ||
| 7 | |||
| 8 | 4269 | int my_compute_power_rec(int nb, int p) | |
| 9 | { | ||
| 10 | int result; | ||
| 11 | |||
| 12 |
2/2✓ Branch 0 taken 3166 times.
✓ Branch 1 taken 1103 times.
|
4269 | if (p > 0) { |
| 13 | 3166 | result = nb; | |
| 14 | 3166 | result = result * my_compute_power_rec(nb, p - 1); | |
| 15 |
2/2✓ Branch 0 taken 1102 times.
✓ Branch 1 taken 1 times.
|
1103 | } else if (p == 0) { |
| 16 | 1102 | result = 1; | |
| 17 | } else { | ||
| 18 | 1 | result = 0; | |
| 19 | } | ||
| 20 | 4269 | return result; | |
| 21 | } | ||
| 22 |