Mandatory finished

This commit is contained in:
2025-11-17 12:40:49 +01:00
parent 506d90d9c1
commit dabbfa7a35
73 changed files with 238 additions and 11 deletions

26
src/print_number.c Normal file
View File

@@ -0,0 +1,26 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* print_number.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dgaillet <dgaillet@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/11/17 12:26:23 by dgaillet #+# #+# */
/* Updated: 2025/11/17 12:31:22 by dgaillet ### ########lyon.fr */
/* */
/* ************************************************************************** */
#include "../include/ft_printf.h"
#include <unistd.h>
int print_number(int nbr)
{
if (nbr == 0)
return (write(1, "0", 1));
if (nbr < 0)
{
write(1, "-", 1);
return (1 + ft_putnbr_base(nbr * -1, "0123456789", 10));
}
return (ft_putnbr_base(nbr, "0123456789", 10));
}