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.
Bài 1:
uses crt;
var a:array[1..100]of integer;
i,n,min:integer;
begin
clrscr;
write('n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
min:=a[1];
for i:=1 to n do
if min>a[i] then min:=a[i];
writeln(min);
readln;
end.
Bài 2:
uses crt;
var a:array[1..100]of integer;
i,n,max:integer;
begin
clrscr;
write('n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
max:=a[1];
for i:=1 to n do
if max<a[i] then max:=a[i];
writeln(max);
readln;
end.
uses crt;
var a:array[1..100]of integer;
i,n,max,min:integer;
begin
clrscr;
write('n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
max:=a[1];
min:=a[1];
for i:=1 to n do
begin
if max<a[i] then max:=a[i];
if min>a[i] then min:=a[i];
end;
writeln('Gia tri lon nhat la: ',max);
writeln('Gia tri nho nhat la: ',min);
readln;
end.
Program HOC24;
var a: array[1..1000] of integer;
i,k,min: integer;
begin
write('Nhap K: '); readln(k);
for i:=1 to k do
begin
write('Nhap so thu ',i,': '); readln(a[i]);
end;
min:=a[1];
for i:=2 to k do if a[i]<min then min:=a[i];
write('Phan tu nho nhat trong day so la: ',min);
readln
end.
Uses crt;
var i,k,min: longint;
h: array[1..100] of longint;
begin clrscr;
readln(k);
for i:=1 to k do begin
readln(h[i]);
end;
min:=h[1];
for i:=1 to n do begin
if(min>h[i]) then min:=h[i];
end;
writeln(min);
readln;
end.
Var a:array[1..200] of real;
i,n,dem:integer;
s,tbc:real;
Begin
Write('Nhap so luong phan tu n = ');readln(n);
s:=0;
For i:=1 to n do
Begin
Write('Nhap phan tu thu ',i,' = ');readln(a[i]);
s:=s+a[i];
End;
tbc:=s/n;
Write('Trung binh cong la ',tbc:10:2);
Readln;
End.
uses crt;
var n,t1:integer;
s:real;
begin
clrscr;
t1:=0;
s:=1;
repeat
readln\(\left(n\right)\);
if n mod 2=0 then t1:=t1+n
else s:=s*n;
until n=0;
writeln\(\left(t1\right)\);
writeln\(\left(s:4:2\right)\);
readln;
end.
Uses crt;
var max,min,n,i,m,n: longint;
a: array[1..100] of longint
begin clrscr;
for i:=1 to n do begin
if(a[i] mod 2=0) then m:=m+a[i];
if(a[i] mod 2<>0) then n:=n+a[i];
end;
max:=a[1];
min:=a[1];
for i:=1 to n do begin
if(max<a[i]) then max:=a[i];
if(min>a[i]) then min:=a[i];
end;
Writeln('Tong cac phan tu chan: ',m);
Writeln('Tong cac phan tu le: ',n);
Writeln('Phan tu co gia tri lon nhat: ',max);
Writeln('Phan tu co gia tri nho nhat: ',min);
readln;
end.
Uses crt;
var max,min,n,i,m,n: longint;
a: array[1..100] of longint
begin clrscr;
for i:=1 to n do begin
if(a[i] mod 2=0) then m:=m+a[i];
if(a[i] mod 2<>0) then n:=n+a[i];
end;
max:=a[1];
min:=a[1];
for i:=1 to n do begin
if(max<a[i]) then max:=a[i];
if(min>a[i]) then min:=a[i];
end;
Writeln('Tong cac phan tu chan: ',m);
Writeln('Tong cac phan tu le: ',n);
Writeln('Phan tu co gia tri lon nhat: ',max);
Writeln('Phan tu co gia tri nho nhat: ',min);
readln;
end.
1. uses crt;
var a,vt:array[1..100]of integer;
n,i,t,dem:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
repeat
write('A[',i,']='); readln(a[i]);
until a[i]>=0;
end;
t:=0;
for i:=1 to n do
begin
if t<100 then
begin
t:=t+a[i];
dem:=dem+1;
vt[dem]:=i;
end;
end;
writeln(vt[dem]);
readln;
end.
Câu 2:
uses crt;
var a:array[1..30]of integer;
i,n,kt:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
kt:=0;
for i:=1 to n-1 do
if a[i]>=a[j] then kt:=1;
if kt=0 then writeln('Day la day so khong giam')
else writeln('Day khong la day so khong giam');
readln;
end.
program TimSoNhoNhat;
uses crt;
var
n, i: integer;
a, min: real;
begin
clrscr;
write('Nhap so phan tu cua day: ');
readln(n);
write('Nhap cac phan tu cua day: ');
readln(a);
min := a;
for i := 2 to n do
begin
readln(a);
if a < min then
min := a;
end;
writeln('So nho nhat trong day la: ', min:0:2);
readln;
end.