-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFléchettes.c
58 lines (54 loc) · 1.12 KB
/
Fléchettes.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
#include <stdio.h>
#include <stdlib.h>
int main() {
int Nb;
scanf(" %d", &Nb);
int Nb_L;
Nb_L = Nb * 2 - 1;
char lettre = 97;
for (int y = 0; y < Nb; y++) {
int x;
lettre = 97;
for (x = 0; x <= y; x++) {
if (x == y) {
lettre = lettre + x;
while (x < Nb_L - y) {
printf("%c", lettre);
x++;
}
} else
printf("%c", lettre + x);
}
lettre = 97;
x = y - 1;
while (97 + x >= 97) {
lettre = 97 + x;
printf("%c", lettre);
x--;
}
printf("\n");
}
for (int y = Nb - 2; y >= 0; y--) {
int x;
lettre = 97;
for (x = 0; x <= y; x++) {
if (x == y) {
lettre = lettre + x;
while (x < Nb_L - y) {
printf("%c", lettre);
x++;
}
} else
printf("%c", lettre + x);
}
lettre = 97;
x = y - 1;
while (97 + x >= 97) {
lettre = 97 + x;
printf("%c", lettre);
x--;
}
printf("\n");
}
return 0;
}