libft/src/ft_putnbr.c
2023-04-15 06:46:13 +02:00

32 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_putnbr.c :+: :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/13 04:22:10 by djonker #+# #+# */
/* Updated: 2023/02/07 00:40:44 by houtworm ### ########.fr */
/* */
/* ************************************************************************** */
#include "../libft.h"
void ft_putnbr(int n)
{
if (n == -2147483648)
return (ft_putstr("-2147483648"));
if (n < 0)
{
ft_putchar('-');
n = n * -1;
}
if (n >= 10)
{
ft_putnbr(n / 10);
ft_putnbr(n % 10);
}
else
ft_putchar(n + '0');
}