-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_nbrlen.c
31 lines (28 loc) · 1.03 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_nbrlen.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: raqferre <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/17 14:38:02 by raqferre #+# #+# */
/* Updated: 2022/07/05 15:31:25 by raqferre ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_nbrlen(long n)
{
size_t x;
x = 1;
if (n < 0)
{
n = n * -1;
x++;
}
while (n >= 10)
{
n = n / 10;
x++;
}
return (x);
}