From 925989f7e7af67d965e2b501a51068acfe449ab0 Mon Sep 17 00:00:00 2001 From: yctct Date: Wed, 28 Jan 2026 12:43:28 +0100 Subject: Add all files, first commit --- ft_putunsigned.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 ft_putunsigned.c (limited to 'ft_putunsigned.c') diff --git a/ft_putunsigned.c b/ft_putunsigned.c new file mode 100644 index 0000000..8908de0 --- /dev/null +++ b/ft_putunsigned.c @@ -0,0 +1,29 @@ + +#include "ft_printf.h" + +int ft_putunsigned(unsigned int nb) +{ + char c[11]; + int i; + long int nbl; + int counter; + + nbl = nb; + counter = 0; + if (nbl == 0) + counter += write(1, "0", 1); + i = 0; + while (nbl) + { + c[i] = (nbl % 10) + 48; + nbl = nbl / 10; + i++; + } + while (i > 0) + { + i--; + counter += write(1, &c[i], 1); + } + c[i] = '\0'; + return (counter); +} -- cgit v1.2.3