32 lines
1.1 KiB
C
32 lines
1.1 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_putnbr.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: gbrochar <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2015/11/29 08:58:30 by gbrochar #+# #+# */
|
|
/* Updated: 2015/11/29 10:49:28 by gbrochar ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "libft.h"
|
|
|
|
void ft_putnbr(int n)
|
|
{
|
|
if (n == -2147483648)
|
|
ft_putstr("-2147483648");
|
|
else if (n < 0)
|
|
{
|
|
ft_putchar('-');
|
|
ft_putnbr(-n);
|
|
}
|
|
else if (n > 9)
|
|
{
|
|
ft_putnbr(n / 10);
|
|
ft_putchar(n % 10 + '0');
|
|
}
|
|
else
|
|
ft_putchar(n + '0');
|
|
}
|