-
Notifications
You must be signed in to change notification settings - Fork 2
/
functions-in-c.c
60 lines (52 loc) · 1.49 KB
/
functions-in-c.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* functions-in-c.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ablaamim <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/01/14 23:45:51 by ablaamim #+# #+# */
/* Updated: 2022/01/15 00:19:12 by ablaamim ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
void ft_putnbr(int n)
{
long nbr;
nbr = (long) n;
if (nbr < 0)
{
nbr = -nbr;
write(1, "-", 1);
}
if (nbr > 9)
ft_putnbr(nbr / 10);
write(1, &"0123456789"[nbr % 10], 1);
}
int ft_max_of_four(int a, int b, int c, int d)
{
int max;
max = a;
if (b > max)
max = b;
if (c > max)
max = c;
if (d > max)
max = d;
return (max);
}
int main(int argc, char **argv)
{
(void) argc;
(void) argv;
int a;
int b;
int c;
int d;
scanf("%d %d %d %d", &a, &b, &c, &d);
int answer = ft_max_of_four(a, b, c, d);
ft_putnbr(answer);
return (EXIT_SUCCESS);
}