-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_nlength.c
More file actions
30 lines (27 loc) · 1.03 KB
/
ft_nlength.c
File metadata and controls
30 lines (27 loc) · 1.03 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_nlength.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: sbaiyrov <sbaiyrov@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/02 14:22:21 by sbaiyrov #+# #+# */
/* Updated: 2019/10/02 14:41:19 by sbaiyrov ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_nlength(int n)
{
int r;
if (n == 0)
return (1);
r = 0;
if (n < 0)
r++;
while (n)
{
n /= 10;
r++;
}
return (r);
}