-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_printnbr.c
33 lines (30 loc) · 1.14 KB
/
ft_printnbr.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
33
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printnbr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: namorgha <namorgha@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/23 14:10:33 by namorgha #+# #+# */
/* Updated: 2022/10/27 19:45:32 by namorgha ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_printnbr(long n)
{
int count;
count = 0;
if (n < 0)
{
count += ft_putchar('-');
n = -n;
}
if (n >= 10)
{
count += ft_printnbr(n / 10);
count += ft_printnbr(n % 10);
}
else
count += ft_putchar(n + '0');
return (count);
}