-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_hexadecimal_maj.c
38 lines (34 loc) · 1.27 KB
/
ft_hexadecimal_maj.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_hexadecimal_maj.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cproesch <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/08/05 18:29:23 by cproesch #+# #+# */
/* Updated: 2021/08/05 18:29:29 by cproesch ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
void ft_putnbr_hex_maj(unsigned int hex, int *j)
{
int rest;
if (hex > 15)
{
ft_putnbr_hex_maj((hex / 16), j);
rest = (hex % 16);
if (rest > 9)
ft_putchar(rest + 55);
else
ft_putchar(rest + 48);
}
else if (hex > 9)
ft_putchar(hex + 55);
else
ft_putchar(hex + 48);
(*j)++;
}
void ft_hexadecimal_maj(unsigned int hex, int *j)
{
ft_putnbr_hex_maj(hex, j);
}