| Line | Branch | Exec | Source | 
|---|---|---|---|
| 1 | /* | ||
| 2 | ** EPITECH PROJECT, 2023 | ||
| 3 | ** my_find_prime_sup | ||
| 4 | ** File description: | ||
| 5 | ** Returns the previous prime number starting form a number (nb) | ||
| 6 | */ | ||
| 7 | /** | ||
| 8 | * @file my_find_prime_inf.c | ||
| 9 | * @brief The file containing the my_find_prime_inf function | ||
| 10 | * @author Nicolas TORO | ||
| 11 | */ | ||
| 12 | |||
| 13 | #include "my.h" | ||
| 14 | |||
| 15 | 3 | int my_find_prime_inf(int nb) | |
| 16 | { | ||
| 17 | 3 | int i = 0; | |
| 18 | |||
| 19 | 2/2✓ Branch 0 taken 1 times. ✓ Branch 1 taken 2 times. | 3 | if (nb <= 1) | 
| 20 | 1 | return -1; | |
| 21 | 2/2✓ Branch 1 taken 3 times. ✓ Branch 2 taken 2 times. | 5 | while (my_is_prime(nb - i) == 0) | 
| 22 | 3 | i++; | |
| 23 | 2 | return nb - i; | |
| 24 | } | ||
| 25 |