-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpattern4.c
61 lines (54 loc) · 1.42 KB
/
pattern4.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
#include<stdio.h>
int main()
{
int i,j,k,l,m;
for(i=1; i<=6; i++)
{
if(i<=4)
{
for(j=4; j>=i; j--) printf(" ");
for(k=1; k<=i; k++) printf("o ");
if(i==1) printf(" ");
else if(i==2) printf(" ");
else {};
for(k=1; k<=i; ++k)
{
printf("o ");
if(i==4&&k==1){k++;}
}
}
else if(i>4&&i<=6)
{
for(j=3; j<i; j++) printf(" ");
for(k=7; k>=i; k--) printf("o ");
if(i==6) printf(" ");
for(k=7; k>=i; k--) printf("o ");
}
printf("\n");
}
for(i=1; i<=7; i++)
{
if(i<=4)
{
for(j=4; j>=i; j--) printf(" ");
for(k=1; k<=i; k++) printf("o ");
if(i==1) printf(" ");
else if(i==2) printf(" ");
else {};
for(k=1; k<=i; k++)
{
printf("o ");
if(i==4&&k==1){k++;}
}
}
else if(i>4&&i<=7)
{
for(j=3; j<i; j++) printf(" ");
for(k=7; k>=i; k--) printf("o ");
if(i==6) printf(" ");
else if(i==7) printf(" ");
for(k=7; k>=i; k--) printf("o ");
}
printf("\n");
}
}