-
Notifications
You must be signed in to change notification settings - Fork 2
/
for-loop-in-c.c
67 lines (62 loc) · 1.7 KB
/
for-loop-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
61
62
63
64
65
66
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* for-loop-c.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ablaamim <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/01/15 07:07:27 by ablaamim #+# #+# */
/* Updated: 2022/01/15 07:26:17 by ablaamim ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
void ft_putchar(char *str)
{
while (*str)
write(1, str++, 1);
}
int main(int argc, char **argv)
{
(void) argc;
(void) argv;
int a;
int b;
int x;
scanf("%d\n%d", &a, &b);
x = a;
while (x <= b)
{
if (x <= 9)
{
if (x == 1)
ft_putchar("one\n");
else if (x == 2)
ft_putchar("two\n");
else if (x == 3)
ft_putchar("three\n");
else if (x == 4)
ft_putchar("four\n");
else if (x == 5)
ft_putchar("five\n");
else if (x == 6)
ft_putchar("six\n");
else if (x == 7)
ft_putchar("seven\n");
else if (x == 8)
ft_putchar("eight\n");
else if (x == 9)
ft_putchar("nine\n");
}
else if (x > 9)
{
if (x % 2 == 0)
ft_putchar("even\n");
else
ft_putchar("odd\n");
}
x++;
}
return (EXIT_SUCCESS);
}