1.
program phuongt;
uses crt;
var a, b: integer;
begin
clrscr;
write('Nhap a = '); readln(a);
write('Nhap b = '); readln(b);
while a<>b do if a>b then a:=a-b else b:=b-a;
write('UCLN(', a, ', ', b, ') = ', a);
readln
end.
2.
program phuongt;
uses crt;
var a, b, c, d: byte;
x, y, i, k, l, m: integer;
begin
clrscr;
write('Nhap a = '); readln(a);
write('Nhap b = '); readln(b); l:=b;
write('Nhap c = '); readln(c);
write('Nhap d = '); readln(d);
write('a. Hai phan so vua nhap: ');
writeln(a, '/', b, ' va ', c, '/', d);
write('Tong hai phan so ', a, '/', b, ' va ', c, '/', d, ' la: ');
if b=d then
begin
x:=a+c;
k:=0;
if x=b then write('1');
if x>b then
begin
for i:=1 to b do if x mod i = 0 then k:=i;
if b/k<>1 then write(x/k:1:0, '/', b/k:1:0);
if b/k=1 then write(x/k:1:0);
end;
k:=0;
if x<b then
begin
while x<>b do if b>x then b:=b-x else x:=x-b;
write((a+c)/x:1:0, '/', l/x:1:0);
end;
end;
if b<>d then
begin
x:=a*d+b*c;
m:=b*d;
k:=0;
if x=m then write('1');
if x>m then
begin
for i:=1 to m do if x mod i = 0 then k:=i;
if m/k<>1 then write(x/k:1:0, '/', m/k:1:0);
if m/k=1 then write(x/k:1:0);
end;
k:=0;
if x<m then
begin
while x<>m do if m>x then m:=m-x else x:=x-m;
write((a*d+b*c)/x:1:0, '/', (b*d)/x:1:0);
end;
end;
readln
end.
3.
program phuongt;
uses crt;
var A: array[1..10] of integer;
i, n, max, j, d: integer;
begin
clrscr;
for i:=1 to n do
begin
write('A[', i, '] = '); readln(A[i]);
end;
max:=A[1];
for i:=1 to 10 do if max<A[i] then max:=A[i];
write('So lon nhat: ', max);
for i:=1 to n do
begin
for j:=1 to n do
begin
d:=0;
if A[i]=A[j] then d:=d+1;
end;
if d=0 then write(A[i]:3);
end;
readln
end.
Câu 1:
uses crt;
var i,a,b:longint;
begin
clrscr;
write('Nhap a,b (a,b<100000)= '); readln(a,b);
i:=a;
while (a mod i<>0)or(b mod i<>0) do dec(i);
writeln('UCLN(',a,',',b,')=',i);
readln
end.
Câu 2:
uses crt;
var a,b,c,d,e,f,e1,f1,i:longint;
begin
clrscr;
write('Nhap a= '); readln(a);
write('Nhap b= '); readln(b);
write('Nhap c= '); readln(c);
write('Nhap d= '); readln(d);
writeln('Hai phan so vua nhap la: ',a,'/',b,'; ',c,'/',d);
i:=b;
while (i mod b<>0)or(i mod d<>0) do inc(i);
e:=a*(i div b)+c*(i div d);
f:=i; e1:=e; f1:=f;
while e1<>f1 do
if e1>f1 then e1:=e1-f1 else f1:=f1-e1;
writeln('Tong hai phan so la: ',a,'/',b,' + ',c,'/',d,'=',e div e1,'/',f div e1);
readln
end.
Câu 3:
uses crt;
var i,j,n,d,max:longint; a:array[1..1000000]of longint;
begin
clrscr;
write('Nhap so n: (n<=10000) ');readln(n);
for i:=1 to n do
begin
write('Nhap phan ti thu ',i,': ');readln(a[i]);
if max<a[i] then max:=a[i];
end;
writeln('Phan tu lon nhat: ',max);
writeln('Tat ca cac so khac nhau: ');
for i:=1 to n do
begin
d:=0;
for j:=1 to i do
if a[i]=a[j] then inc(d);
if d=1 then write(a[i],' ');
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