-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_nbr_len_bonus.c
More file actions
33 lines (30 loc) · 1.07 KB
/
Copy pathft_nbr_len_bonus.c
File metadata and controls
33 lines (30 loc) · 1.07 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_nbr_len_bonus.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: obouizi <obouizi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/12/01 14:17:27 by obouizi #+# #+# */
/* Updated: 2024/12/05 20:48:09 by obouizi ### ########.fr */
/* */
/* ************************************************************************** */
#include "libftprintf_bonus.h"
int ft_nbr_len(int nb)
{
int len;
if (nb == 0)
return (1);
len = 0;
if (nb < 0)
{
len++;
nb = -nb;
}
while (nb != 0)
{
nb /= 10;
len++;
}
return (len);
}