-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_printunsigned.c
More file actions
50 lines (45 loc) · 1.32 KB
/
Copy pathft_printunsigned.c
File metadata and controls
50 lines (45 loc) · 1.32 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printunsigned.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: abali <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/01/25 23:26:11 by abali #+# #+# */
/* Updated: 2023/01/25 23:26:26 by abali ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int static get_size(unsigned long int n)
{
int count;
count = 0;
if (n == 0)
{
return (1);
}
while (n > 0)
{
n = n / 10;
count++;
}
return (count);
}
int ft_printunsigned(unsigned long int n)
{
int count;
unsigned long int dummy;
dummy = n;
count = 0;
if (n > 9)
{
ft_printunsigned(n / 10);
ft_printunsigned(n % 10);
}
else
{
ft_printchar(n % 10 + 48);
}
count = get_size(dummy);
return (count);
}