-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_count_nbr.c
28 lines (25 loc) · 1.03 KB
/
ft_count_nbr.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_count_nbr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cprune <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2015/12/10 17:43:52 by cprune #+# #+# */
/* Updated: 2015/12/11 14:29:58 by cprune ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_count_nbr(int nbr)
{
int i;
i = 0;
if (nbr == 0)
return (1);
while (nbr != 0)
{
nbr = nbr / 10;
i++;
}
return (i);
}