Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.
uses crt;
var e,f,i,a,b,c,d: byte;
begin
clrscr;
write('Tu so = '); readln(e);
write('Mau so = '); readln(f);
a:=e;
b:=f;
writeln('Phan so ban dau: ',e,'/',f);
while E <> F do
if E > F then E:=E-F
else F:=F-E;
If e <> 1 then
begin
a:=a div e;
b:=b div e;
write('Phan so toi gian: ',a,'/',b);
end
else write('Phan so da toi gian, ',a,'/',b);
readln
end.
1.
Program HOC24;
var a: array[1..32000] of longint;
i,n: integer;
tc,tl: longint;
begin
write('Nhap N: '); readln(n);
tc:=0; tl:=0;
for i:=1 to n do
begin
write('a[',i,']='); readln(a[i]);
if a[i] mod 2=0 then tc:=tc+a[i];
if a[i] mod 2=1 then tl:=tl+a[i];
end;
writeln('Tong chan la: ',tc);
write('Tong le la: ',tl);
readln
end.
2.
Program HOC24;
var a: array[1..32000] of longint;
d1,d2,i,n: integer;
begin
write('Nhap N: '); readln(n);
d1:=0; d2:=0;
for i:=1 to n do
begin
write('a[',i,']='); readln(a[i]);
if a[i] >0 then d1:=d1+1;
if a[i] <0 then d2:=d2+1;
end;
writeln('Co ',d1,' so lon hon 0');
write('Co ',d2,' so be hon 0');
readln
end.
uses crt;
var n,i,s:integer;
begin
clrscr;
n:=1;
s:=0;
repeat
s:=s+n;
n:=n+1;
until s>1000;
writeln(n);
readln;
end.
program XuatSoChan;
uses crt;
const
Max_N = 20;
type
MangSoNguyen = array [1..Max_N] of integer;
var
A: MangSoNguyen;
i, n: integer;
begin
clrscr;
write('Nhap so luong phan tu cua mang: ');
readln(n);
writeln('Nhap cac phan tu vao mang:');
for i := 1 to n do
begin
write('A[', i, ']: ');
readln(A[i]);
end;
writeln('Cac so chan trong mang la:');
for i := 1 to n do
begin
if A[i] mod 2 = 0 then
writeln(A[i]);
end;
readln;
end.
uses crt;
var i,n,t:integer;
begin
clrscr;
readln(n);
t:=0;
for i:=1 to n do t:=t+i;
writeln(t);
readln;
end.
program TICHSO;
var
n, i, j, maxVal, a_i, a_j: Integer;
begin
maxVal := 0;
Readln(n);
for i := 1 to n do
begin
Read(a_i);
if Abs(a_i) > maxVal then
maxVal := Abs(a_i);
end;
for i := 1 to n-1 do
begin
for j := i+1 to n do
begin
a_i := Abs(a[i]);
a_j := Abs(a[j]);
if (a_i * a_j) > maxVal then
maxVal := a_i * a_j;
end;
end;
Writeln(maxVal);
end.