Bài 69:
program tong_vitri;
uses crt;
var n,i,a,s1,s2:integer;
begin
clrscr;
write('Nhap n: '); readln(n);
s1:=0; s2:=0;
for i:=1 to n do
begin
write('Nhap so thu ',i,': '); readln(a);
if i mod 2=1 then s1:=s1+a else s2:=s2+a;
end;
write('s1 - s2 = ',s1,' - ',s2,' = ',s1-s2);
readln;
end.
Bài 71:
program tong_dolech;
uses crt;
var n,i,a,b,t:integer;
begin
clrscr;
write('Nhap n: '); readln(n);
t:=0;
for i:=1 to n do
begin
write('Nhap so thu ',i,': '); readln(a);
if i<>1 then t:=t+abs(a-b);
b:=a;
end;
write('Tong do lech la: ',t);
readln;
end.
Bài 72:
program do_lech_max;
uses crt;
var n,i,a,b,max:integer;
begin
clrscr;
write('Nhap n: '); readln(n);
max:=0;
for i:=1 to n do
begin
write('Nhap so thu ',i,': '); readln(a);
if (i<>1) and abs(a-b)>max then max:=abs(a-b);
end;
write('Do lech lon nhat la: ',max);
readln;
end.
69.
program phuongt;
uses crt;
var n, x, s1, s2, s: integer;
begin
clrscr;
write('Nhap n = '); readln(n);
i:=1;
s1:=0;
s2:=0;
while i<=n do
begin
write('Nhap so thu ', i, ': '); readln(x);
if x mod 2 = 0 then s2:=s2+x else s1:=s1+x;
end;
s:=s1-s2;
write('Gia tri = ', s);
readln
end.
70.
program phuongt;
uses crt;
var n, x, s1, s2, s: integer;
begin
clrscr;
write('Nhap n = '); readln(n);
i:=1;
s1:=0;
s2:=0;
while i<=n do
begin
write('Nhap so thu ', i, ': '); readln(x);
if x>0 then if x mod 2 = 0 then s2:=s2+x else s1:=s1+x;
end;
s:=s1-s2;
write('Gia tri = ', s);
readln
end.
71.
program phuongt;
uses crt;
var n, i, x, t, a, c, s: integer;
begin
clrscr;
write('Nhap n = '); readln(n);
i:=1;
c:=0;
s:=0;
t:=0;
a:=1;
while i<=n do
begin
write('Nhap so thu ', i, ': '); readln(x);
t:=a;
a:=x;
if t>a then c:=t-a else c:=a-t;
s:=s+c;
i:=i+1;
end;
write('Tong do chenh lech giua 2 gia tri lien ke nhau: ', s);
readln
end.
72.
program phuongt;
uses crt;
var n, i, x, t, a, c, s: integer;
begin
clrscr;
write('Nhap n = '); readln(n);
i:=1;
c:=0;
s:=0;
t:=0;
a:=1;
while i<=n do
begin
write('Nhap so thu ', i, ': '); readln(x);
t:=a;
a:=x;
if t>a then c:=t-a else c:=a-t;
if s<c then s:=c;
i:=i+1;
end;
write('Do chenh lech lon nhat giua 2 gia tri lien ke nhau: ', s);
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