-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathone_1.c
42 lines (32 loc) · 1.02 KB
/
one_1.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
// https://github.com/Noraldim/odevler- ==> daha aciklama icin // README.md
// this will bild the perment of letter from top to down IN
#include <stdio.h>
int main() {
int i, x, y, t;
// kullanicidan piramidin uzunlugu alacagiz
char letter = 'A';
// kullancidan piramidin uzunlgu alacacgiz
printf("piramidin yuksekligini giriniz: ");
scanf("%d", &x);
//Dongu, harflerden onceki bosluklari yazdıracaktir.
for (i = 1; i <= x; i++) {
for (y = x - i; y >= 1; y--) {
printf(" ");
}
/*İkinci dongu, her satir icin harfleri yazdirir.
Her satır icin harf sayisi 2 * i - 1 olarak hesaplanir.*/
for (t = 1; t <= 2 * i - 1; t++) {
printf("%c", letter);
if (t < i) {
letter++;
} else {
letter--;
}
}
//ilk == A , A++ ==> B , B++ ==> C ::: ...etc
//D-- ==>C , C-- ==> B , B-- ==> A ::: ...etc
printf("\n");
letter = 'A';
}
return 0;
}