-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_putnbr_fd.c
28 lines (25 loc) · 1.1 KB
/
ft_putnbr_fd.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putnbr_fd.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jovicto2 <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/05/25 15:31:13 by jovicto2 #+# #+# */
/* Updated: 2023/05/25 15:33:12 by jovicto2 ### ########.fr */
/* */
/* ************************************************************************** */
#include "../includes/libft.h"
void ft_putnbr_fd(int n, int fd)
{
long nbr;
nbr = n;
if (nbr < 0)
{
nbr *= -1;
ft_putchar_fd('-', fd);
}
if (nbr / 10 > 0)
ft_putnbr_fd(nbr / 10, fd);
ft_putchar_fd(nbr % 10 + '0', fd);
}