-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_getfirstdecimal.c
24 lines (21 loc) · 1.01 KB
/
ft_getfirstdecimal.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_getfirstdecimal.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: nvienot <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/03/16 00:12:27 by nvienot #+# #+# */
/* Updated: 2019/03/16 03:41:42 by nvienot ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_getfirstdecimal(float n)
{
int nb;
n = n * 10;
nb = (int)n;
if (nb < 0)
nb = -nb;
return (nb % 10);
}