-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathexample3.c
46 lines (39 loc) · 818 Bytes
/
example3.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
#include <stdio.h>
int min(int a, int b){
return a < b ? a : b;
}
int main(){
int n, i, j;
double z = 3;
scanf("%d", &n);
int k = n / 2 + 1, t = 1;
char c = 'A';
for(i = 0; i < n; i ++){
for(j = 0; j < n; j++){
if(t == 1){
if(j >= n - k || (j == 0 && k == 1)){
printf(".");
}else{
printf("%c", c);
}
}else{
if(j < k){
printf(".");
}else{
printf("%c", c);
}
}
}
if(t == 1)
k--;
else
k++;
if(k == 0){
t = 0;
k = 2;
}
c += 1;
printf("\n");
}
return 0;
}