-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhw3hourglass.c
51 lines (51 loc) · 911 Bytes
/
hw3hourglass.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
#include <stdio.h>
int spacen = 1;
int letter = 1;
int i = 0;
int ii = 0;
int iii = 0;
void Triangle(int x) {
letter = x;
while (x/2 > i)
{
i++;
ii = 0;
iii = 0;
letter= letter - 2;
while (iii < spacen)
{
printf("%s", " ");
iii++;
}
while (ii <= letter)
{
printf("%d", 1);
ii++;
}
spacen++;
printf("\n");
}
spacen = x/2; letter = 1; i = 0; ii = 0; iii = 0;
while (x/2 > i)
{
i++;
ii = 0;
iii = 0;
while (ii <= spacen)
{
printf("%s", " ");
ii++;
}
spacen--;
while (iii < letter)
{
printf("%d", 1);
iii++;
}
letter = letter +2;
printf("\n");
}
}
int main(){
Triangle(36);
}