a)
program ct;
ues crt;
var A:array [1..1000] of integer;
i,j,n,tg:integer;
begin clrscr;
write('Nhap so phan tu n: '); readln(n);
for i:=1 to n do
begin
writeln('Nhap so thu ',i,': '); readln(A[i]);
end;
for i:=1 to n-1 do
for j:=i+1 to n do
if A[i]>A[j] then
begin
tg:=A[i];
A[i]:=A[j];
A[j]:=tg;
end;
writeln('Day so sap xep theo thu tu tang dan la: ');
for i:=1 to n do
write(A[i]:3);
readln;
end.
b)
program ct;
ues crt;
var A:array [1..1000] of integer;
i,j,n,tg:integer;
begin clrscr;
write('Nhap so phan tu n: '); readln(n);
for i:=1 to n do
begin
writeln('Nhap so thu ',i,': '); readln(A[i]);
end;
for i:=1 to n-1 do
for j:=i+1 to n do
if A[i]<A[j] then
begin
tg:=A[i];
A[i]:=A[j];
A[j]:=tg;
end;
writeln('Day so sap xep theo thu tu giam dan la: ');
for i:=1 to n do
write(A[i]:3);
readln;
end.
Câu 2:
program ct;
ues crt;
var A:array [1..1000] of integer;
i,n:integer;
Tbc:real;
begin clrscr;
write('Nhap so phan tu n: '); readln(n);
for i:=1 to n do
begin
writeln('Nhap so thu ',i,': '); readln(A[i]);
end;
Tbc:=0;
for i:=1 to n do
Tbc:=(Tbc+A[i])/n;
writeln('Trung binh cong la: ',Tbc);
readln;
end.
Câu 3:
program ct;
ues crt;
var A:array [1..1000] of integer;
i,n:integer;
begin clrscr;
write('Nhap so phan tu n: '); readln(n);
for i:=1 to n do
begin
writeln('Nhap so thu ',i,': '); readln(A[i]);
end;
for i:=1 to n do
if i mod 2=0 then write(A[i]);
writeln;
for i:=1 to n do
if i mod 2<>0 then write(A[i]);
readln;
end.
uses crt;
var i,k,j,n,tam,dem,x:integer;
a: array [1..50] of integer;
begin
clrscr;
write('n=');readln(n);
for i:= 1 to n do
beginwrite('a[',i,']=');
readln(a[i]);
end;
for i:= 1 to n-1 do
for j:= i+1 to n do
begin
if A[i]<a[j] then
begin
tam:=a[i];
a[i]:=a[j];
a[j]:=tam;
end;
write('mang sau khi sap xep');
for= j:=1 to n do
write(a[j]:5);
writeln;
begin
write('nhap vao so nguyen x : ');
readln(x);
i:=1
k:=n+1;
while= (i<n) and (k=n+1) do
begin if x> a[i] then k := i;
i:= i + 1;
end;
for i := n downto k do a[i + 1] := a[i];a[k]:= x;
writeln('DAY SAU KHI CHEN x:');
for i := 1 to n + 1 do write(a[i]:5);
end;
readln;
end.
Tin học, tiếng Anh: informatics, tiếng Pháp: informatique, là một ngành khoa học chuyên nghiên cứu quá trình tự động hóa việc tổ chức, lưu trữ, xử lý và truyền dẫn thông tin của một hệ thống máy tính cụ thể hoặc trừu tượng (ảo). Với cách hiểu hiện nay, tin học bao hàm tất cả các nghiên cứu và kỹ thuật có liên quan đến việc mô phỏng, biến đổi và tái tạo thông tin.
Nguồn : Wikipedia - Bách khoa toàn thưLớp 8 - Năm thứ ba ở cấp trung học cơ sở, học tập bắt đầu nặng dần, sang năm lại là năm cuối cấp áp lực lớn dần nhưng các em vẫn phải chú ý sức khỏe nhé!
Nguồn : ADMIN :))Xem thêm tại https://loigiaisgk.com/cau-hoi or https://giaibtsgk.com/cau-hoi
Copyright © 2021 HOCTAPSGK