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.
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.
uses crt;
var a:array[1..1000000] of longint;
n,i,s:longint;
begin
clrscr;
write('Nhap so luong phan tu: '); readln(n);
for i:=1 to n do
begin
write('Nhap phan tu thu ',i,': '); readln(a[i]);
if a[i] mod 2=1 then inc(s,a[i]);
end;
write('Tong cac so le: ',s);
readln;
end.
uses crt;
var a:array[1..100]of integer;
i,n,h:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
h:=0;
for i:=1 to n do
if a[i] mod 2=0 then h:=h-a[i];
writeln(h);
readln;
end.
Program HOC24;
var d,i,n: integer;
a: array[1..1000] of integer;
begin
write('Nhap do dai cua day: '); readln(n);
for i:=1 to n do
begin
write('Nhap phan tu thu ',i,': '); readln(a[i]);
end;
d:=0;
for i:=1 to n do if a[i] mod 2=1 then d:=d+1;
write('Co tat ca ',d,' gia tri le');
readln
end.
uses crt;
var n,i:integer;
a:array[1..100] of integer;
begin
clrscr
write(‘nhap so phan tu cua day:’);readln(n);
for i:=1 to n do
begin
write(‘a[‘,i,’]=’);readln(a[i]);
end;
writeln(‘day so da nhap:’);
for i:=1 to n do write(a[i]:2);
readln;
end.
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;
writeln('Day so vua nhap la: ');
for i:=1 to n do
write(a[i]:4);
writeln;
max:=a[1];
for i:=1 to n do
if max<a[i] then max:=a[i];
writeln('So lon nhat la: ',max);
readln;
end.
uses crt;
var a:array[1..100]of integer;
i,n:integer;
begin
clrscr;
write('n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
readln;
end.