-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_upperhexa.c
More file actions
29 lines (25 loc) · 1.14 KB
/
Copy pathft_upperhexa.c
File metadata and controls
29 lines (25 loc) · 1.14 KB
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_upperhexa.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mtran <mtran@student.42.fr> #+# +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025-12-06 15:29:13 by mtran #+# #+# */
/* Updated: 2025-12-06 15:29:13 by mtran ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_putchar(char c);
int count_hexa(unsigned int nb);
int ft_upperhexa(unsigned int n)
{
char *str_base;
int i;
i = 0;
str_base = "0123456789ABCDEF";
if (n >= 16)
i += ft_upperhexa(n / 16);
i += ft_putchar(str_base[n % 16]);
return (i);
}