-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_hexanbr.c
28 lines (25 loc) · 1.12 KB
/
ft_hexanbr.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_hexanbr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hchairi <hchairi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/11/05 16:50:57 by hchairi #+# #+# */
/* Updated: 2022/11/09 22:41:27 by hchairi ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_hexanbr(unsigned long int nb, char *base)
{
int count;
count = 0;
if (nb < 16)
count += ft_putchar(base[nb]);
else
{
count += ft_hexanbr(nb / 16, base);
count += ft_hexanbr(nb % 16, base);
}
return (count);
}