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 a:array[1..100]of integer;
min,n,i:integer;
{----------------chuong-trinh-con-------------------}
function nn(x,y:integer):integer;
begin
if x<y then nn:=x
else nn:=y;
end;
{-----------------chuong-trinh-chinh-----------------}
begin
clrscr;
write('nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
min:=nn(a[1],a[2]);
for i:=3 to n do
if min>a[i] then min:=a[i];
writeln(min);
readln;
end.
Var so,n,i:integer;
s:longint;
Begin
Write('n = ');readln(n);
For i:=1 to n do
Begin
Write('Nhap so thu ',i,' = ');readln(so);
If (so mod 3 = 0) and (so mod 5 = 0) then
s:=s+so;
End;
Write('Tong la ',s);
Readln;
End.
uses crt;
const fi='kiemtra.txt';
var f1:text;
a:array[1..100]of integer;
min,n,i:integer;
{----------------chuong-trinh-con-------------------}
function nn(x,y:integer):integer;
begin
if x<y then nn:=x
else nn:=y;
end;
{-----------------chuong-trinh-chinh-----------------}
begin
clrscr;
write('nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
min:=nn(a[1],a[2]);
for i:=3 to n do
if min>a[i] then min:=a[i];
writeln(min);
readln;
end.
Mình xin sửa lại một chút:
uses crt;
const fi='kiemtra.txt';
var f1:text;
a:array[1..100]of integer;
min,n,i:integer;
{----------------chuong-trinh-con-------------------}
function nn(x,y:integer):integer;
begin
if x<y then nn:=x
else nn:=y;
end;
{-----------------chuong-trinh-chinh-----------------}
begin
clrscr;
assign(f1,fi); reset(f1);
readln(f1,n);
for i:=1 to n do
read(f1,a[i]);
min:=nn(a[1],a[2]);
for i:=3 to n do
if min>a[i] then min:=a[i];
writeln(min);
readln;
end.
uses crt;
var a:array[1..200]of integer;
n,i,k,t,t1:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
write('Nhap k='); readln(k);
t:=0;
for i:=1 to n do
if a[i] mod 2<>0 then t:=t+a[i];
t1:=0;
for i:=1 to n do
if a[i] mod k=0 then t1:=t1+a[i];
writeln('Tong cac phan tu le la: ',t);
writeln('Tong cac phan tu la boi cua ',k,' la: ',t1);
readln;
end.
Program HOC24;
var a: array[1..32000] of integer;
i,n,tg,c,l: integer;
tc,tl: longint;
begin
write('Nhap N: '); readln(n);
c:=0; l:=0; tc:=0; tl:=0;
for i:=1 to n do
begin
write('Nhap so thu ',i,': '); readln(a[i];
if a[i] mod 2=0 then
begin
c:=c+1;
tc:=tc+a[i];
end;
if a[i] mod 2=1 then
begin
l:=l+1;
tl:=tl+a[i];
end;
end;
write('Day da sap xep: ');
for i:=1 to n do if a[i] mod 2=1 then write(a[i],' ');
for i:=1 to n do if a[i] mod 2=0 then write(a[i],' ');
writeln;
wirteln('Co ',l,' so le');
writeln('Co ',c,' so chan');
writeln('Tong cac so le la: ',tl);
writeln('Tong cac so chan la:', tc);
readln
end.
uses crt;
var m,n,t,i:integer;
begin
clrscr;
repeat
write('Nhap n='); readln(n);
write('Nhap m='); readln(m);
until m<n;
t:=0;
for i:=m to n do
if (i mod 3=0) and (i mod 5=0) then t:=t+i;
writeln('Tong cac so chia het cho 3 va 5 trong khoang tu ',m,' toi ',n,' la: ',t);
readln;
end.