Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.
Program hotrotinhoc;
var a,b: array[1..6] of integer;
i,j,tg: integer;
begin
a[1]:=3; a[2]:=1; a[3]:=7; a[4]:=9; a[5]:=5;
b[1]:=10; b[2]:=2; b[3]:=8; b[4]:=9; b[5]:=6; b[6]:=5;
for i:=1 to 5 do
for j:=i to 5 do
if a[i]>a[j] then
begin
tg:=a[i];
a[i]:=a[j];
a[j]:=tg;
end;
write('Day 1 sau khi doi cho la : ');
for i:=1 to 5 do write(a[i],' ');
writeln;
write('Day 2 sau khi doi cho la : ');
for i:=1 to 6 do
for j:=i to 6 do
if b[i]<b[j] then
begin
tg:=b[i];
b[i]:=b[j];
b[j]:=tg;
end;
for i:=1 to n do write(b[i],' ');
readln
end.
1)
Var array:[1..1000] of integer;
i,n,t:integer;
Begin
Write('n = ');readln(n);
For i:=1 to n do
Begin
Write('Nhap so thu ',i,' = ');readln(a[i]);
End;
For i:=1 to n do
If a[i] > a[i+1] then
Begin
t:=a[i];
a[i]:=a[i+1];
a[i+1]:=t;
End;
Write('Sap xep tang dan ');
For i:=1 to n do write(a[i]:8);
Readln
End.
2)
Var array:[1..1000] of integer;
i,n,t:integer;
Begin
Write('n = ');readln(n);
For i:=1 to n do
Begin
Write('Nhap so thu ',i,' = ');readln(a[i]);
End;
For i:=1 to n do
If a[i] < a[i+1] then
Begin
t:=a[i];
a[i]:=a[i+1];
a[i+1]:=t;
End;
Write('Sap xep giam dan ');
For i:=1 to n do write(a[i]:8);
Readln
End.
uses crt;
var a:array[1..100]of integer;
i,n,t,kt,j:integer;
begin
clrscr;
readln(n);
for i:=1 to n do readln(a[i]);
t:=0;
for i:=1 to n do
if a[i] mod 2<>0 then t:=t+a[i];
writeln(t);
for i:=1 to n do
if trunc(sqrt(a[i]))=sqrt(a[i]) then write(a[i]:4);
writeln;
for i:=1 to n do
if a[i]>1 then
begin
kt:=0;
for j:=2 to trunc(sqrt(a[i])) do
if a[i] mod j=0 then kt:=1;
if kt=0 then write(a[i]:4);
end;
readln;
end.