【问题】输出由字母组成的“字母塔”。例如:输入C,则输出:
A
ABA
ABCBA
ABCDCBA
【参考程序】
var i,zimu,j,k:char;
begin
repeat
writeln('input a char:');
readln(zimu);
zimu:=upcase(zimu);
until (zimu>='A') and (zimu<='Z');
for i:='A' to zimu do begin
write(' ':(ord(zimu)-ord(i))+1); {留空格}
for j:='A' to i do write(j); {顺序写字母}
for j:=pred(i) downto 'A' do write(j); {逆序写字母}
if (ord(i)-64) mod 25=0 then readln {如超一页,要暂停分页显示}
else writeln;
end;
end.