-
Notifications
You must be signed in to change notification settings - Fork 0
/
x.c
60 lines (53 loc) · 1.4 KB
/
x.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
48
49
50
51
52
53
54
55
56
57
58
59
60
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* x.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: pboonpro <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/11/17 18:53:14 by pboonpro #+# #+# */
/* Updated: 2022/11/17 18:53:14 by pboonpro ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int xlen(unsigned int num)
{
int i;
if (num == 0)
return (1);
i = 0;
while (num > 0)
{
i++;
num /= 16;
}
return (i);
}
int x(unsigned int n)
{
int len;
len = xlen(n);
if (n > 15)
{
x(n / 16);
n = n % 16;
}
if (n <= 9)
c(n + 48);
if (n >= 10 && n <= 15)
{
n = n % 10;
c(n + 97);
}
return (len);
}
/*int main()
{
int a;
int b;
a = x(16);
printf("\n%d\n", a);
b = printf("%x", 16);
printf("\n%d\n",b);
return (0);
}*/