bài 1:
uses crt;
var n:integer;
function kt(n:integer):boolean;
var i,s:integer;
begin
s:=0;
for i:=1 to n do
if n mod i =0 then s:=s+1;
if s=2 then kt:=true else kt:=false;
end;
begin
clrscr;
write('nhap so n:');readln(n);
n:=n+1;
while kt(n)=false do n:=n+1;
write(n);
readln;
end.
bài 2:
uses crt;
var i,j,n: longint;
function ktt(n: longint):longint;
var i,s:longint;
begin
s:=0;
for i:=1 to n-1 do
if n mod i = 0 then s:=s+i;
ktt:=s;
end;
begin
clrscr;
write('N='); readln(n);
for i:=1 to n do
for j:=1 to n do
if (ktt(j)=i) and (ktt(i)=j) then writeln(i,'-',j);
readln
end.
bài 3:
uses crt;
var i,j,n,tam,x,k,d:integer;
a:Array[1..100] of integer;
begin
clrscr;
write('nhap so ptu:');readln(n);
for i:=1 to n do
begin
write('A[',i,']=');
readln(a[i]);
if (a[i] mod 2=0) and(a[i] mod 3=0) then d:=d+1;
end;
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],' ');
writeln;
writeln(d);
write('nhap so bat ky:');readln(x);
tam:=0;
//chen vao dau mang
if (x<=a[1]) and(tam=0) then
begin
for i:=n+1 downto 2 do a[i]:=a[i-1];
a[1]:=x;
for i:=1 to n+1 do write(a[i],' ');
tam:=1;
end;
//chen vao cuoi mang
if tam=0 then
if x>a[n] then
begin
a[n+1]:=x;
for i:=1 to n+1 do write(a[i],' ');
tam:=1;
end;
//chem vao giua mang
if tam=0 then
begin
for i:=1 to n do
if (a[i-1]<=x) and (x<=a[i] )then begin k:=i;break;end;
for i:=n+1 downto k do a[i]:=a[i-1];
a[k]:=x;
for i:=1 to n+1 do write(a[i],' ');
end;
readln;
end.
1.
uses crt;
var n: longint;
function nt(n: longint): boolean;
var i: longint;
begin
if n<2 then exit(false);
for i:=2 to round(sqrt(n)) do if n mod i = 0 then exit(false);
exit(true);
end;
begin
clrscr;
readln(n);
inc(n);
while not(nt(n)) do inc(n);
write(n);
readln
end.
2.
uses crt;
var n,i,j: longint;
function tong(n: longint): longint;
var i: longint;
begin
tong:=0;
for i:=1 to n-1 do if n mod i = 0 then tong:=tong+i;
end;
begin
clrscr;
readln(n);
for i:=1 to n do for j:=1 to n do if (tong(i)=j) and (i=tong(j)) then writeln(i,'-',j);
readln
end.
3.
uses crt;
var n,i,j,d,tg,x,k: longint;
a: array[1..1000001] of longint;
begin
clrscr;
readln(n);
d:=0;
for i:=1 to n do begin
read(a[i]);
if (a[i] mod 2 = 0) and (a[i] mod 3 = 0) then d:=d+1;
end;
for i:=1 to n 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;
for i:=1 to n do write(a[i],' ');
writeln;
writeln(d);
readln(x);
if x>a[n] then a[n]:=x
else for i:=1 to n do if (a[i-1]<=x) and (x<=a[i]) then begin
k:=i;
break;
end;
a[k]:=x;
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 :))Xem thêm tại https://loigiaisgk.com/cau-hoi or https://giaibtsgk.com/cau-hoi
Copyright © 2021 HOCTAPSGK