GCC Code Coverage Report


Directory: ./
File: lib/my/my_compute_square_root.c
Date: 2024-06-05 00:29:21
Exec Total Coverage
Lines: 10 10 100.0%
Functions: 1 1 100.0%
Branches: 7 8 87.5%

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