-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_puthexa_upper.c
24 lines (22 loc) · 1.11 KB
/
ft_puthexa_upper.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_puthexa_upper.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tchevrie <tchevrie@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/09/20 17:21:01 by tchevrie #+# #+# */
/* Updated: 2022/10/05 05:35:24 by tchevrie ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
size_t ft_puthexa_upper(const unsigned int n)
{
if (n / 16)
return (ft_puthexa_upper(n / 16) + ft_puthexa_upper(n % 16));
else if (!(n / 10))
ft_putchar(n + '0');
else
ft_putchar((char) n - 10 + 'A');
return (1);
}