1 输入一个大写字母,如 F,输出
2
3 比如:
4
5 输入:F
6
7 输出:
8
9 F
10
11 EFE
12
13 DEFED
14
15 CDEFEDC
16
17 BCDEFEDCB
18
19 ABCDEFEDCBA
20
21 #include<stdio.h>
22 int main(void)
23 {
24 char c;
25 scanf("%c",&c);
26 int i,j,k,count;
27 count = c - 'A' + 1;
28 for(i=0; i<count; i++)
29 {
30 for(k=0; k< count-i-1; k++)
31 {
32 printf(" ");
33 }
34 for(j=0; j < 2*i+1; j++)
35 {
36 if(j-i>0)
37 printf("%c",c+(i-j));
38 else
39 printf("%c",c+(j-i));
40 }
41 printf("
");
42 }
43 return 0;
44 }