-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_nbrlen.c
31 lines (28 loc) · 1.05 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: mboutuil <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/11/20 14:44:32 by mboutuil #+# #+# */
/* Updated: 2022/11/23 02:45:40 by mboutuil ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_nbrlen(long long int nb, int base)
{
int i;
i = 0;
if (nb <= 0)
{
nb *= -1;
i++;
}
while (nb > 0)
{
nb /= base;
i++;
}
return (i);
}