-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_printnbr.c
31 lines (27 loc) · 1.08 KB
/
ft_printnbr.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printnbr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: daxferab <[email protected] +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/20 17:14:04 by daxferab #+# #+# */
/* Updated: 2024/03/20 17:29:15 by daxferab ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
static int ft_numlen(int n)
{
int i;
i = 0;
if (n <= 0)
++i;
while (n && ++i)
n /= 10;
return (i);
}
int ft_printnbr(int num)
{
ft_putnbr_fd(num, 1);
return (ft_numlen(num));
}