-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_digcount_base.c
More file actions
28 lines (26 loc) · 1.05 KB
/
ft_digcount_base.c
File metadata and controls
28 lines (26 loc) · 1.05 KB
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_digcount_base.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: loram <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/09/21 18:52:22 by loram #+# #+# */
/* Updated: 2019/09/21 19:09:30 by loram ### ########.fr */
/* */
/* ************************************************************************** */
int ft_digcount_base(unsigned int n, int base)
{
int i;
if (base < 2)
return (0);
if (n == 0)
return (1);
i = 0;
while (n > 0)
{
n = n / base;
i++;
}
return (i);
}