-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_put_unsigned.c
32 lines (29 loc) · 1.14 KB
/
ft_put_unsigned.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_put_unsigned.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: oqaroot <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/01 20:40:06 by oqaroot #+# #+# */
/* Updated: 2024/08/03 21:53:15 by oqaroot ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_put_unsigned(unsigned int n)
{
int len;
char num[11];
int i;
i = 10;
len = 0;
num[i--] = '\0';
if (n == 0)
return (ft_putchar('0'));
while (n)
{
num[i--] = (n % 10) + '0';
n /= 10;
}
return (len + (ft_putstr(&num[i + 1])));
}