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.
Đề 1:
uses crt;
var a:array[1..100]of integer;
i,n,min:integer;
begin
clrscr;
write('Nhap 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.
Đề 2:
uses crt;
var a:array[1..100]of integer;
i,n,max:integer;
begin
clrscr;
write('Nhap 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.
program mang;
uses crt;
var n,i,chan, le,max,min: Integer;
a:array[1..100] of integer;
begin
write('nhap so phan tu ');read(n);
for i:=1 to n do
begin
write('nhap so thu ',i); readln(a[i]);
end;
max:=a[1]; min:=a[1]; chan:=0;le:=0;
for i:=1to n do
begin
if a[i] > max then max:=a[i];
if a[i] < min then min:=a[i];
if a[i] mod 2 = 0 then chan:=chan+1
else le:=le+1;
end;
writeln('max la: ',max);
writeln('min la: ',min);
writeln('so phan tu chan: ',chan);
writeln('so phan tu le: ',le);
readln
end.
program TimMaxMinCuaMang;
var
mang: array of integer;
n, i, max, min: integer;
begin
write('Nhap so phan tu cua mang: ');
readln(n);
setlength(mang, n);
writeln('Nhap cac phan tu cua mang:');
for i := 0 to n-1 do
begin
readln(mang[i]);
end;
max := mang[0];
min := mang[0];
for i := 1 to n-1 do
begin
if mang[i] > max then
max := mang[i];
if mang[i] < min then
min := mang[i];
end;
writeln('Phan tu lon nhat la: ', max);
writeln('Phan tu nho nhat la: ', min);
readln;
end.
Var a:array:[1..1000] of integer;
i,n,min,max:integer;
Begin
Write('N = ');readln(n);
For i:=1 to n do
Begin
Write('Nhap so thu ',i,' = ');readln(a[i]);
End;
max:=a[1];
min:=a[1];
For i:=2 to n do
begin
If a[i] > max then max:=a[i];
if a[i] < min then min:=a[i];
end;
writeln('So lon nhat la ',max);
write('So nho nhat la ',min);
Readln
End.
Program HOC24;
var min,max,i,n: integer;
a: array[1..1000] of integer;
begin
write('Nhap 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:=2 to n do
begin
if a[i]> max then max:=a[i];
if a[i]<min then min:=a[i];
end;
writeln('Gia tri lon nhat la: ',max);
write('Gia tri nho nhat la: ',min);
readln
end.
uses crt;
var n,max,i:integer;
a:array[1..100]of integer;
begin
clrscr;
write('Nhap 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.
Program HOC24;
var a: array[1..32000] of integer;
i,max,,n: integer;
begin
write('Nhap so phan tu 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 a[i]<max then max:=a[i];
write('So lon nhat la: ',max);
readln
end.
uses crt;
var a:array[1..1000000] of longint;
n,i,max:longint;
begin
clrscr;
write('Nhap so luong phan tu: '); readln(n);
max:=a[1];
for i:=1 to n do
begin
write('Nhap phan tu thu ',i,': '); readln(a[i]);
if a[i]>max then max:=a[i];
end;
writeln('GTLN: ',max);
readln;
end.
Bài 5:
Var a:array:[1..1000] of integer;
i,n,max:integer;
sc, sl:longint;
Begin
Write('n = ');readln(n);
For i:=1 to n do
Begin
Write('Nhap so thu ',i,' = ');rreadlna[i]);
If a[i] mod 2 = 0 then sc:=sc+b[i];
If a[i] mod 2 <> 0 then sl:=sl+a[i];
End;
max:=a[1];
For i:=2 to n do
If a[i] > max then max:=a[i];
Writeln('Tong cac so chan la ',sc);
Writeln('Tong cac so le la ',sl);
write('So lon nhat la ',max);
Readln
End.
Program HOC24;
var a: array[1..32000] of integer;
i,max,min,n: integer;
begin
write('Nhap so phan tu 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 a[i]>max then max:=a[i];
if a[i]<min then min:=a[i];
end;
writeln('So nho nhat la :',max);
write('So lon nhat la: ',min);
readln
end.
uses crt;
var a:array[1..100]of integer;
i,n,max,min:integer;
begin
clrscr;
write('Nhap 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('So lon nhat la: ',max);
writeln('So nho nhat la: ',min);
readln;
end.