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 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 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.
uses crt;
var n, i, j, dem: longint; {Bạn có thể thay longint thành integer nha}
A:array[1..1000] of longint;
begin
clrscr;
Write('Nhap N: '); readln(n);
for i:=1 to n do
begin
write('Nhap phan tu thu ',i,': ');
readln(A[i]);
end;
Write('Cac so nguyen to co trong mang la: ');
for i:=1 to n do
begin
dem:=0;
for j:=2 to A[i]/2 do
if A[i] mod j=0 then dem:=dem+1;
if dem=0 then write(A[i],'; ');
end;
end.
uses crt;
var a:array[1..100]of integer;
i,n,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
t:=0;
for i:=1 to n do
t:=t+a[i];
writeln(t);
readln;
end.
uses crt;
var a:array[1..100]of integer;
i,n,t:integer;
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
write(a[i]:4);
writeln;
t:=0;
for i:=1 to n do
if a[i] mod 3=0 then t:=t+a[i];
writeln(t);
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;
max:=a[1];
for i:=1 to n do
if max<a[i] then max:=a[i];
writeln(max);
readln;
end.
cho in ra màn hình giá trị nhỏ nhất cùng luôn thì làm như thế nào bạn
var a:array[1..1000] of integer;
i,n,min:integer;
begin
write('n = ');readln(n);
for i:=1 to n do
begin
write('Nhap so thu ',i,' = ');readln(a[i]);
end;
min:=a[1];
for i:=2 to n do
if min > a[i] then min:=a[i];
write('So nho nhat la ',min);
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.
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 n,i,max : integer;
a : array[1..100] of integer;
begin
clrscr;
write('Nhap so n :'); readln(n);
for i:=1 to n do
begin
write('Nhap phan tu thu ',i,' la : '); readln(a[i]);
end;
max:=a[1];
for i:=2 to n do if max<a[i] then max:=a[i];
write('So *** nhat trong mang la :', max);
min:=a[1];
for i:=2 to n do if min>a[i] then min:=a[i];
write('So nho nhat trong mang la :', min);
readln
end.