-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_nbrlen.c
36 lines (33 loc) · 1.08 KB
/
ft_nbrlen.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_nbrlen.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dvan-der <dvan-der@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/12/15 08:22:08 by dvan-der #+# #+# */
/* Updated: 2021/12/15 08:22:10 by dvan-der ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_nbrlen(long long nbr)
{
int i;
i = 0;
if (nbr == 0)
{
i++;
return (i);
}
if (nbr < 0)
{
i++;
nbr *= -1;
}
while (nbr > 0)
{
nbr = nbr / 10;
i++;
}
return (i);
}