-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_putnbr_fd.c
25 lines (22 loc) · 1.13 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putnbr_fd.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gaaraujo <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/12/09 18:28:29 by gaaraujo #+# #+# */
/* Updated: 2024/12/09 19:19:46 by gaaraujo ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_putnbr_fd(int n, int fd)
{
int multiplier;
multiplier = ((n >= 0) * 2) - 1;
if (multiplier == -1)
ft_putchar_fd('-', fd);
if (n / 10)
ft_putnbr_fd((n / 10) * multiplier, fd);
ft_putchar_fd((n % 10 * multiplier) + '0', fd);
}