-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchristmas.c
37 lines (37 loc) · 914 Bytes
/
christmas.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
#include <stdio.h>
int main(){
int num = 15 ;
for (int i = 1 ; i <= 3 ; i ++){
for (int j = 1 ; j <= num ; j ++ ){
for (int k = 1 ; k <= (2*num-1) ; k ++){
if ( i >= 2 && (j >= 1 && j <= 3)){
continue;
}
else if (k >= num-(j-1) && k <= num+(j-1) ){
printf("*");
}
else {
printf(" ");
}
}
if (i >= 2 && (j >= 1 && j <= 3)){
continue;
}
else{
printf("\n");
}
}
}
// A Stick
for (int i = 1 ; i <= 3 ; i++){
for (int j = 1 ; j <= num ; j ++){
if ( j == num ){
printf("*\n");
}
else {
printf(" ");
}
}
}
return 0 ;
}