mirror of
https://github.com/Arkia-Groupe/radar.git
synced 2026-01-18 16:37:38 +01:00
20 lines
304 B
C
20 lines
304 B
C
/*
|
|
** EPITECH PROJECT, 2023
|
|
** CPoolDay07
|
|
** File description:
|
|
** ./my_compute_square_root.c
|
|
*/
|
|
|
|
#include "lib.h"
|
|
|
|
int my_compute_square_root(int nb)
|
|
{
|
|
if (nb <= 0)
|
|
return 0;
|
|
for (int i = 1; i <= nb / 2 + 1; i++) {
|
|
if (i * i == nb)
|
|
return (i);
|
|
}
|
|
return (0);
|
|
}
|