-
Notifications
You must be signed in to change notification settings - Fork 0
/
print_hex_digit.c
27 lines (25 loc) · 1.15 KB
/
print_hex_digit.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* print_hex_digit.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: sprodatu <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/12/07 19:20:17 by sprodatu #+# #+# */
/* Updated: 2024/05/03 21:54:55 by sprodatu ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft/libft.h"
#include "ft_printf.h"
int print_hex_digit(unsigned int digit, int case_type)
{
if (digit < 10)
return (ft_putchar('0' + digit));
else
{
if (case_type)
return (ft_putchar('A' + digit - 10));
else
return (ft_putchar('a' + digit - 10));
}
}