-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_putnbr_bonus.c
More file actions
33 lines (30 loc) · 1.17 KB
/
Copy pathft_putnbr_bonus.c
File metadata and controls
33 lines (30 loc) · 1.17 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putnbr_bonus.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: obouizi <obouizi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/29 18:03:26 by obouizi #+# #+# */
/* Updated: 2024/12/05 20:49:20 by obouizi ### ########.fr */
/* */
/* ************************************************************************** */
#include "libftprintf_bonus.h"
int ft_putnbr(int n)
{
int count;
count = 0;
if (n == -2147483648)
return (write(1, "-2147483648", 11));
if (n < 0)
{
count += ft_putchar('-');
n = -n;
}
if (n >= 10)
{
count += ft_putnbr(n / 10);
}
count += ft_putchar((n % 10) + '0');
return (count);
}