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.
Var z:array[1..1000] of longint;
n, i, max:longint;
Begin
Readln(n);
For i:=1 to n do begin writeln('s',i,'=');
Readln(z[i]);
max:= z[1];
End;
uses crt;
var a:array[1..100]of integer;
i,n,max,dem1,dem2: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('So lon nhat la: ',max);
readln;
end.
uses crt;
Var a:array[1..100000] of longint;
i,n,max:longint;
Begin
clrscr;
write('Nhap n: '); readln(n);
For i:=1 to n do
Begin
Write('A[',i,'] = '); Readln(A[i]);
end;
for i:=1 to n do
if a[i]>max then max:=a[i];
write('Gia tri lon nhat trong day so vua nhap la: ',max);
readln
end.
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,dem: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('Gia tri lon nhat la: ',max);
dem:=0;
for i:=1 to n do
if a[i] mod 2=0 then inc(dem);
writeln('So so chan la: ',dem);
readln;
end.
uses crt;
var a:array[1..100]of integer;
n,i,t1,t2:integer;
begin
clrscr;
readln(n);
for i:=1 to n do readln(a[i]);
for i:=1 to n do write(a[i]:4);
writeln;
for i:=1 to n do
if a[i] mod 2=0 then write(a[i]:4);
writeln;
for i:=1 to n do
if a[i] mod 2<>0 then write(a[i]:4);
writeln;
t1:=0;
t2:=0;
for i:=1 to n do
begin
if a[i] mod 2=0 then t1:=t1+a[i]
else t2:=t2+a[i];
end;
writeln(t1);
writeln(t2);
readln;
end.
program Tim_so;
var
n, i, max, count: integer;
arr: array[1..100] of integer;
begin
writeln('Nhap vao so n: ');
readln(n);
writeln('Nhap vao day so: ');
for i := 1 to n do
begin
readln(arr[i]);
end;
max := arr[1];
count := 1;
for i := 2 to n do
begin
if(arr[i] > max) then
begin
max := arr[i];
count := 1;
end
else if(arr[i] = max) then
begin
count := count + 1;
end;
end;
writeln('So lon nhat la: ', max);
writeln('Co ', count, ' so lon nhat trong day.');
readln;
end.
program b1;
uses crt;
var a:array[1..100] of integer; i,n,max,min:integer;
begin
clrscr;
write('Nhap vao so nguyen n:');
readln(n);
for i:=1 to n do
readln(a[i]);
min:=a[1];
max:=a[1];
for i:=2 to n do
begin
if(a[i]<min) then min:=a[i];
if(a[i]>max) then max:=a[i];
end;
writeln(' gia tri lon nhat = ',max);
writeln(' gia tri nho nhat = ',min);
readln;
end.
Tham khảo!
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.
a)
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.
b)
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.