-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_putnbr.c
executable file
·36 lines (33 loc) · 1.1 KB
/
ft_putnbr.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
34
35
36
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putnbr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ioleksiu <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/20 16:08:03 by ioleksiu #+# #+# */
/* Updated: 2016/12/20 20:34:52 by ioleksiu ### ########.fr */
/* */
/* ************************************************************************** */
#include "lem_in.h"
void ft_putnbr(int n)
{
char p;
unsigned int z;
z = n;
if (n < 0)
{
write(1, "-", 1);
z = -z;
}
if (z >= 10)
{
ft_putnbr(z / 10);
ft_putnbr(z % 10);
}
else
{
p = z + 48;
write(1, &p, 1);
}
}