- 10 Tháng hai 2020
- 10
- 1
- 6
- 18
- Bình Phước
- Trường TH & THCS Lương Thế Vinh


Mình bị lỗi " exited with exitcode = 201 " giúp mình với ạ .Cảm ơn mọi người!!
File code:
File code:
Mã:
uses crt;
var f:text;
a:array[1..1000] of integer;
i,j,n,tong,tam:integer;
procedure tinhtong;
begin
for i:=1 to n do
tong:=tong+a[i];
writeln(f,tong);
end;
procedure giamdan;
begin
if a[i]<a[j] then
for i:=1 to n-1 do
for j:=i+1 to n do
write(f,a[i]:2);
end;
procedure tangdan;
begin
if a[i]>a[j] then
for i:=1 to n-1 do
for j:=i-1 to n do
write(f,a[i]);
end;
begin
assign(f,'tonghopday.inp');
reset(f);
readln(f,n);
for i:=1 to n do
read(f,a[i]);
assign(f,'tonghopday.out');
rewrite(f);
tinhtong;
if a[1] mod 2 = 0 then tangdan
else if a[1] mod 2 <> 0 then giamdan;
close(f);
end.