-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path200101110_part2.c
94 lines (83 loc) · 2.04 KB
/
200101110_part2.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
#include <stdio.h>
void DrawShape(int sayi);
int main()
{
int sayi;
printf("Please Enter The Height (2*n) Of The Figure : ");
scanf("%d",&sayi);
if (sayi > 1){
DrawShape(sayi);
}
else{
printf("You Entered An Invalid Value");
}
return 0;
}
void DrawShape(int sayi){
int i,j;
int satir = sayi + 2;
int k = sayi + sayi - 1;
int bosluk = k-2;
int yildiz = 0;
for(i=0 ; i<satir ; i++){
if (i == 0){ /* 1. SATIR _ _ */
for(j=0 ; j<k ; j++){
printf(" ");
}
printf("_ _\n");
}
else if (i == 1) { /* 2. SATIR / | \ */
for(j=0 ; j<k-1 ; j++){
printf(" ");
}
printf("/ | \\ \n");
}
else { // ÜST ÜÇGEN
for(j=0 ; j<bosluk ; j++){
printf(" ");
}
printf("/ /");
bosluk--;
for (j=0 ; j<=yildiz ; j++){
if(j==yildiz){
printf("*\\ \\");
}
else{
printf("* ");
}
}
yildiz++;
printf("\n");
}
}
satir = sayi + 2;
k = sayi + sayi - 1;
bosluk = sayi-2;
yildiz = 0;
for(i=0 ; i<satir-1 ; i++){
if (i == satir-2) { /* SON SATIR \_|_/ */
for(j=0 ; j<k-1 ; j++){
printf(" ");
}
printf("\\_|_/ \n");
}
else { // ALT ÜÇGEN
for(j=0 ; j<bosluk ; j++){
printf(" ");
}
printf("\\ \\");
bosluk++;
for (j=0 ; j<sayi ; j++){
if(j==sayi-1){
printf("*/ /");
}
else{
printf("* ");
}
}
sayi--;
printf("\n");
}
}
return 0;
}