-
Notifications
You must be signed in to change notification settings - Fork 0
/
rush01.c
45 lines (41 loc) · 1.4 KB
/
rush01.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* rush04.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: anishkha <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/10/14 15:45:09 by anishkha #+# #+# */
/* Updated: 2023/10/15 19:10:31 by dapetros ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdlib.h>
#include <unistd.h>
void ft_putchar(char c);
void rush(int a, int b)
{
int i;
int j;
if (a <= 0 || b <= 0)
{
write(1, "Incorrect Input\n", 16);
exit(1);
}
i = 0;
while (++i <= a)
{
j = 0;
while (++j <= b)
{
if ((i == 1 && j == 1) || (i == a && j == b && i != 1 && j != 1))
ft_putchar('/');
else if ((i == 1 && j == b) || (i == a && j == 1))
ft_putchar('\\');
else if ((j > 1 && j < b) && (i > 1 && i < a))
ft_putchar(' ');
else
ft_putchar('*');
}
ft_putchar('\n');
}
}