-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_putnbr.c
29 lines (26 loc) · 1.09 KB
/
ft_putnbr.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putnbr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mgiraldo <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/18 19:30:21 by mgiraldo #+# #+# */
/* Updated: 2020/02/19 16:04:06 by mgiraldo ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_putnbr(int n)
{
unsigned nbr;
if (n < 0)
{
ft_putchar('-');
nbr = (unsigned int)(n * -1);
}
else
nbr = (unsigned int)n;
if (nbr > 9)
ft_putnbr(nbr / 10);
ft_putchar(nbr % 10 + 48);
}