wip_parsing
This commit is contained in:
31
libft/Ft_Printf/ft_putnbr_uns_int.c
Normal file
31
libft/Ft_Printf/ft_putnbr_uns_int.c
Normal file
@ -0,0 +1,31 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_putnbr_uns_int.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: madumerg <madumerg@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/17 13:18:12 by madumerg #+# #+# */
|
||||
/* Updated: 2023/11/28 12:16:03 by madumerg ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "ft_printf.h"
|
||||
|
||||
int ft_putnbr_uns_int(unsigned int n)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
i = 0;
|
||||
if (n < 10)
|
||||
{
|
||||
i += ft_putchar(n + '0');
|
||||
return (i);
|
||||
}
|
||||
else if (n >= 10)
|
||||
{
|
||||
i += ft_putnbr(n / 10);
|
||||
i += ft_putnbr(n % 10);
|
||||
}
|
||||
return (i);
|
||||
}
|
Reference in New Issue
Block a user