| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | ** EPITECH PROJECT, 2023 | ||
| 3 | ** my_compute_square_root | ||
| 4 | ** File description: | ||
| 5 | ** square root of int in iterative | ||
| 6 | */ | ||
| 7 | |||
| 8 | 3 | int my_compute_square_root(int nb) | |
| 9 | { | ||
| 10 | 3 | int i = 1; | |
| 11 | |||
| 12 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 2 times.
|
3 | if (nb == 0) |
| 13 | 1 | return 0; | |
| 14 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 1 times.
|
6 | while (i * i <= nb) { |
| 15 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 4 times.
|
5 | if (nb / i == i |
| 16 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | && nb % i == 0) { |
| 17 | 1 | return i; | |
| 18 | } | ||
| 19 | 4 | i++; | |
| 20 | } | ||
| 21 | 1 | return 0; | |
| 22 | } | ||
| 23 |