-
Notifications
You must be signed in to change notification settings - Fork 2
/
sum-numbers-c.c
51 lines (46 loc) · 1.42 KB
/
sum-numbers-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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* sum-numbers.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ablaamim <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/01/14 22:19:16 by ablaamim #+# #+# */
/* Updated: 2022/01/14 23:13:09 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 main(int argc, char **argv)
{
(void) argc;
(void) argv;
int i1;
int i2;
float f1;
float f2;
scanf("%d", &i1);
scanf("%d", &i2);
ft_putnbr(i1 + i2);
write(1, " ", 1);
ft_putnbr(i1 - i2);
scanf("%f", &f1);
scanf("%f", &f2);
printf("%.1f ", f1 + f2);
printf("%.1f", f1 - f2);
return (EXIT_SUCCESS);
}