var n,i:longint;
A:array[1..100] og longint;
function nt(n:longint):boolean;
var i:longint;
begin
nt:=false;
if n<2 then exit;
for i:=2 to n div 2 do
if n mod i=0 then exit;
nt:=true;
end;
begin
readln(n);
for i:=1 to n do read(a[i]);readln;
for i:=1 to n do
if nt(a[i]) then write(a[i],' ');
readln
end.
bài 2:
var n,i,tam:longint;
a:array[1..100] of longint;
begin
readln(n);
for i:=1 to n do read(a[i]);readln;
for i:=1 to n-1 do
for j:=i+1 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 write(a[i],' ');
readln
end.
Câu 1:
uses crt;
var a:array[1..10000] of integer;
n,i,s,j:integer;
check:boolean;
begin
clrscr;
write('Nhap so luong phan tu: '); readln(n);
for i:=1 to n do
begin
write('Nhap so thu ',i,': '); readln(a[i]);
end;
if a[i]<2 then exit;
if a[i]=2 then inc(s,a[i]);
for i:=1 to n do
begin
j:=2;
while (a[i] mod j<>0) and (j<sqrt(a[i])) do inc(j);
if j>sqrt(a[i]) then check:=true
else check:=false;
if check then inc(s,a[i]);
end;
write('Tong cac so nguyen to: ',s);
readln;
end.
Câu 2:
uses crt;
var a:array[1..10000] of integer;
n,i,j,t:integer;
begin
clrscr;
write('Nhap so luong phan tu: '); readln(n);
for i:=1 to n do
begin
write('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
t:=a[i];
a[i]:=a[j];
a[j]:=t;
end;
write('Day so tang dan: ');
for i:=1 to n do write(a[i],' ');
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 :))Copyright © 2021 HOCTAP247