-
Notifications
You must be signed in to change notification settings - Fork 0
/
ilen.c
47 lines (42 loc) · 1.21 KB
/
ilen.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_ilen.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jraymond <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/02/02 11:44:03 by jraymond #+# #+# */
/* Updated: 2018/05/01 11:49:24 by jraymond ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ilen(intmax_t arg)
{
int i;
intmax_t res;
i = 0;
res = arg;
if (res == 0)
return (1);
while (res)
{
res = res / 10;
i++;
}
return (i);
}
int ft_uilen(uintmax_t arg)
{
int i;
uintmax_t res;
i = 0;
res = arg;
if (res == 0)
return (1);
while (res)
{
res = res / 10;
i++;
}
return (i);
}