-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_hexalen.c
33 lines (30 loc) · 1.09 KB
/
ft_hexalen.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
32
33
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_hexalen.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: krios-fu <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/28 04:09:48 by krios-fu #+# #+# */
/* Updated: 2020/02/29 16:58:56 by krios-fu ### ########.fr */
/* */
/* ************************************************************************** */
#include "printf.h"
int ft_hexalen(unsigned long nb)
{
int count;
unsigned int n;
n = nb;
count = 0;
if (n >= 16)
{
while (n >= 16)
{
++count;
n /= 16;
}
}
if (n >= 0)
count++;
return (count);
}