-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_printf_di.c
37 lines (32 loc) · 1.13 KB
/
ft_printf_di.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf_di.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mcoskune <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/29 15:59:49 by mcoskune #+# #+# */
/* Updated: 2024/04/30 00:20:23 by mcoskune ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
static size_t ft_len(int n)
{
size_t len;
len = 0;
if (n <= 0)
len++;
while (n)
{
n /= 10;
len++;
}
return (len);
}
int ft_printf_di(int nb)
{
size_t counter;
counter = ft_len(nb);
ft_putnbr_fd(nb, 1);
return (counter);
}