forked from randerson112358/C-Programs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
christmasTree.c
100 lines (80 loc) · 1.7 KB
/
christmasTree.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# include <stdio.h>
# include <math.h>
int main(void)
{
int w= 20;
int z = 200000000;
int a = 20;
int m;
//creates walking people
while(a != -1){
printf("\n\n\n\n\n\n\n\n\n\n\n\n\n");
if(a !=0){
printf(" o");//1
for(m=0; m<=a; m++){printf(" ");}
if(a%2 == 0)
printf(" o");
else
printf(" o");
printf("\n/|\\");//1
for(m=0; m<=a; m++){printf(" ");}
if(a%2 ==0)
printf("o/|\\");
else
printf("/|\\");
printf("\n/\\");//1
for(m=0; m<=a; m++){printf(" ");}
if(a%2 == 0)
printf(" /\\");
else
printf(" o/\\");
}
else
{
printf(" o");printf(" o");
printf("\n/|\\");printf("<3/|\\");
printf("\n/\\"); printf(" /\\");
while(z!= 0){ z--;}// wasting time
z=2000000000;
}
while(z!= 0){ z--;}// wasting time
z=200000000;
system("cls");
a--;
}
while(w != 0){
int c = '*';
int i=0, j=0, k=0,l;
int n=20, sum =1;
char left[31];
char right[31];
//char t = '//';
strcpy(right,"/");
/* Seed random number generator */
int seed = time(NULL);
srand(seed);
int y = rand()%50;
int x=n;
// draws the triangle
for(i=0; i<n; i++)
{
for(k=0; k<=x; k++)
{printf(" ");}
x--;
for(j=0; j<sum; j++)
{printf("%c", c);}
sum+= 2;
printf("\n");
}
for(k=0; k<=y; k++)
{
printf(" ");
}
printf("Merry Christmas !!");
while(z!= 0){ z--;}// wasting time
z=2000000000;
system("cls");
w--;
}
system("pause");
}