-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_digits.c
More file actions
28 lines (25 loc) · 1.07 KB
/
ft_digits.c
File metadata and controls
28 lines (25 loc) · 1.07 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_digits.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: yazhu <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/12/21 16:20:06 by yazhu #+# #+# */
/* Updated: 2018/01/10 14:55:14 by yazhu ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_digits(unsigned long long nbr, int base)
{
int digits;
digits = 0;
if (nbr == 0)
return (1);
while (nbr > 0)
{
digits++;
nbr /= base;
}
return (digits);
}