-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_count_digits.c
26 lines (24 loc) · 1.03 KB
/
ft_count_digits.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_count_digits.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: yochered <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/12/14 10:49:32 by yochered #+# #+# */
/* Updated: 2018/12/14 10:49:33 by yochered ### ########.fr */
/* */
/* ************************************************************************** */
int ft_count_digits(int nbr, int base)
{
int digits;
digits = 0;
if (nbr <= 0)
digits++;
while (nbr)
{
digits++;
nbr /= base;
}
return (digits);
}