Em hãy viết một chương trình theo tuần tự về ngày cuối tuần của em
0 bình luận về “Em hãy viết một chương trình theo tuần tự về ngày cuối tuần của em”
uses crt; var n,i,j,tam:longint;a:array[1..100]of longint; begin clrscr; readln(n); for i:=1 to n do readln(a[i]); for i:=1 to n do for j:=i to n do if(a[i]>a[j])then begin tam:=a[i]; a[i]:=a[j]; a[j]:=tam; end; for i:=1 to n do if(a[i]>0)then write(a[i],’ ‘); writeln; for i:=n downto 1 do if(a[i]<0)then write(a[i],’ ‘); readln; end.
uses crt;
var n,i,j,tam:longint;a:array[1..100]of longint;
begin
clrscr;
readln(n);
for i:=1 to n do
readln(a[i]);
for i:=1 to n do
for j:=i to n do
if(a[i]>a[j])then
begin
tam:=a[i];
a[i]:=a[j];
a[j]:=tam;
end;
for i:=1 to n do
if(a[i]>0)then write(a[i],’ ‘);
writeln;
for i:=n downto 1 do
if(a[i]<0)then write(a[i],’ ‘);
readln;
end.