-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_simpleop.c
42 lines (40 loc) · 1.29 KB
/
ft_simpleop.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_simpleop.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ohachim <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/10/16 01:43:50 by ohachim #+# #+# */
/* Updated: 2018/10/17 18:44:40 by ohachim ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_simpleop(int a, int b, char c)
{
if (c == '*')
{
ft_putstr(ft_itoa(a * b));
ft_putchar('\n');
}
else if (c == '/')
{
ft_putstr(ft_itoa(a / b));
ft_putchar('\n');
}
else if (c == '+')
{
ft_putstr(ft_itoa(a + b));
ft_putchar('\n');
}
else if (c == '-')
{
ft_putstr(ft_itoa(a - b));
ft_putchar('\n');
}
else if (c == '/')
{
ft_putstr(ft_itoa(a % b));
ft_putchar('\n');
}
}