diff options
Diffstat (limited to 'ft_putnbr.c')
| -rw-r--r-- | ft_putnbr.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/ft_putnbr.c b/ft_putnbr.c new file mode 100644 index 0000000..856c429 --- /dev/null +++ b/ft_putnbr.c @@ -0,0 +1,17 @@ +#include <unistd.h> +#include "libft.h" + +void ft_putnbr(int n) +{ + unsigned int p_n; + + p_n = n; + if (n < 0) + { + ft_putchar('-'); + p_n = -n; + } + if (p_n > 9) + ft_putnbr(p_n / 10); + ft_putchar(p_n % 10 + '0'); +} |
