pascal问题

2024-11-25 03:36:10
推荐回答(4个)
回答1:

1.
program q1;
var
a,b:integer;
begin
a:=1;
repeat
while(b<>a) do
begin
write('a');
b:=b+1;
end;
a:=a+2;
writeln(' ');
b:=1;
until a=9;
end.
2.
program q2;
var
a,b,c,d:integer;
begin
read(a);
repeat
b:=b+1;
repeat
c:=c+1;
repeat
d:=d+1;
if(b*10+3*d+c*10=b*100+c*10+d)
then
writeln(b*100+c*10+d);
until (d=9)or((b=a mod 100)and(c=a mod 10-a mod 100)and(d=a-a mod 10-a mod 100));
d:=-1;
until (c=9)or((b=a mod 100)and(c=a mod 10-a mod 100)and(d=a-a mod 10-a mod 100));
c:=-1;
until d=a mod 100;
end.
3.
program q3;
var
a,b,c,d:integer;
begin
for a:=10 to 99 do
for b:=0 to 99 do
begin
if(sqr(a+b))=(a*100+b)
then
writeln(a*100+b);
end;
end.
4.
不懂;
5.
program q5;
var
a,b:integer;
begin
for a:=1 to 24 do
begin
for b:=1 to a do
write(chr(b+60),' ');
writeln(' ');
end;
end.
6.请问输出格式;
7.
program q7;
var
a:integer;
begin
for a:=100 to 199 do
if (a mod 3=2)and(a mod 5=3)and(a mod 7=5)
then
writeln(a);
end.

回答2:

这些题都是课本上的一些基础题,关键要细心
巧用循环
如果初学的话,慢慢做就出来了

回答3:

搜索呀
都是循环结构的基本题

回答4:

好基础好基础的题呀!