Pascal数组元素编程题!!!高手来!!!再线等!!!
发布网友
发布时间:2023-09-22 11:43
我来回答
共2个回答
热心网友
时间:2023-11-10 13:53
第1题:
program zuida;
var n,i,t:integer;
a:array[1..999]of integer;
begin
writeln('Qing Shu Ru N ( 0<N<999 )');
write('N = ');
readln(n);
for i:=1 to n do
begin
write('A',i,' = ');
readln(a[i]);
end;
writeln;
t:=-maxint;
for i:=1 to n do
if a[i]>t then t:=a[i];
writeln('Zui Da De Shu Shi: ',t);
readln;
end.
第二题:
program t2;
var
i,t,n:integer;
a:array[1..100] of 0..1;
begin
write('Input n:');
readln(n);
write('n=');
if n<=0 then
begin n:=-n; write('-'); end;
while (n<>0) do
begin
i:=i+1;
t:=n mod 2;
n:=n div 2;
a[i]:=t;
end;
for t:=i downto 1 do
write(a[t]);
readln;
end.
第三题:
program huanxu;
var n,i,t:integer;
a:array[1..999]of integer;
begin
writeln('Qing Shu Ru N ( 0<N<999 )');
write('N = ');
readln(n);
for i:=1 to n do
begin
write('A',i,' = ');
readln(a[i]);
end;
writeln;
for i:=1 to n do
write(a[i]:5);
t:=a[1];
for i:=1 to n-1 do
a[i]:=a[i+1];
a[n]:=t;
writeln(' --->');
for i:=1 to n do
write(a[i]:5);
readln
end.
热心网友
时间:2023-11-10 13:53
1.
var i:integer;
a:integer;
begin
read(max);
for a:=2 to n do
begin
read(i);
if i>max then
max:=i;
end;
writeln(max);
end.