-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_putnbr_fd.c
31 lines (28 loc) · 1.11 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
29
30
31
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putnbr_fd.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: chanheki <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/12 02:41:04 by chanheki #+# #+# */
/* Updated: 2022/07/25 19:10:22 by chanheki ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_putnbr_fd(int n, int fd)
{
int div;
int mod;
div = n / 10;
mod = n % 10;
if (n < 0)
{
ft_putchar_fd('-', fd);
div = -div;
mod = -mod;
}
if (div)
ft_putnbr_fd(div, fd);
ft_putchar_fd(mod + '0', fd);
}