ajout abs, greater, smaller, sign
This commit is contained in:
8
srcs/ft_abs.c
Normal file
8
srcs/ft_abs.c
Normal file
@@ -0,0 +1,8 @@
|
||||
#include "libft.h"
|
||||
|
||||
int ft_abs(int n)
|
||||
{
|
||||
if (n < 0)
|
||||
n *= -1;
|
||||
return (n);
|
||||
}
|
||||
8
srcs/ft_greater.c
Normal file
8
srcs/ft_greater.c
Normal file
@@ -0,0 +1,8 @@
|
||||
#include "libft.h"
|
||||
|
||||
int ft_greater(int a, int b)
|
||||
{
|
||||
if (a < b)
|
||||
return (b);
|
||||
return (a);
|
||||
}
|
||||
8
srcs/ft_sign.c
Normal file
8
srcs/ft_sign.c
Normal file
@@ -0,0 +1,8 @@
|
||||
#include "libft.h"
|
||||
|
||||
int ft_sign(int i)
|
||||
{
|
||||
if (i < 0)
|
||||
return (-1);
|
||||
return (1);
|
||||
}
|
||||
8
srcs/ft_smaller.c
Normal file
8
srcs/ft_smaller.c
Normal file
@@ -0,0 +1,8 @@
|
||||
#include "libft.h"
|
||||
|
||||
int ft_smaller(int a, int b)
|
||||
{
|
||||
if (a > b)
|
||||
return (b);
|
||||
return (a);
|
||||
}
|
||||
Reference in New Issue
Block a user