This commit is contained in:
root
2026-02-23 00:04:03 +00:00
commit fadb328b05
17 changed files with 573 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putnbr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: sgongas <sgongas@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/02/22 23:03:38 by sgongas #+# #+# */
/* Updated: 2026/02/22 23:12:01 by sgongas ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putchar(char c)
{
write(1, &c, 1);
}
void ft_putnbr(int nb)
{
if (nb == -2147483648)
{
write(1, "-2147483648", 11);
return ;
}
if (nb < 0)
{
ft_putchar('-');
nb = -nb;
}
if (nb > 9)
ft_putnbr(nb / 10);
ft_putchar(nb % 10 + '0');
}
// int main(void)
// {
// ft_putnbr(21474);
// return (0);
// }