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.
#include <bits/stdc++.h>
using namespace std;
long long a[1000],i,n,ln;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
ln=a[1];
for (i=1; i<=n; i++) ln=max(ln,a[i]);
cout<<ln;
return 0;
}
program in_mang;
uses crt;
var i,n,max:longint;
a:array[1..100]of longint;
begin
clrscr;
write('nhap so n:');readln(n);
for i:=1 to n do
begin
write('a[',i,']=');readln(a[i]);
end;
writeln('cac phan tu chan:');
for i:=1 to n do
if a[i] mod 2=0 then write(a[i]:3);
writeln;
max:=a[1];
for i:=1 to n do
if max<a[i] then max:=a[i];
writeln('max cua day la:',max);
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;
for i:=1 to n do
if a[i] mod 2=0 then write(a[i]:4);
writeln;
max:=a[1];
for i:=1 to n do
if max<a[i] then max:=a[i];
writeln(max);
readln;
end.
var a:array[1..1000] of integer;
i,n,min:integer;
s:longint;
begin
write('n = ');readln(n);
for i:=1 to n do
begin
write('Nhap so thu ',i,' = ');readln(a[i]);
s:=s+a[i];
end;
writeln('Tong la ',s);
min:=a[1];
for i:=2 to n do
if a[i] < min then min:=a[i];
write('Cac so chan la ');
for i:=1 to n do
if a[i] mod 2 = 0 then write(a[i]:8);
writeln;
write('so nho nhat la ',min);
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;
t:=0;
for i:=1 to n do
if a[i]>0 then t:=t+a[i];
writeln(t);
readln;
end.
1)
Var array:[1..1000] of integer;
i,n,t:integer;
Begin
Write('n = ');readln(n);
For i:=1 to n do
Begin
Write('Nhap so thu ',i,' = ');readln(a[i]);
End;
For i:=1 to n do
If a[i] > a[i+1] then
Begin
t:=a[i];
a[i]:=a[i+1];
a[i+1]:=t;
End;
Write('Sap xep tang dan ');
For i:=1 to n do write(a[i]:8);
Readln
End.
2)
Var array:[1..1000] of integer;
i,n,t:integer;
Begin
Write('n = ');readln(n);
For i:=1 to n do
Begin
Write('Nhap so thu ',i,' = ');readln(a[i]);
End;
For i:=1 to n do
If a[i] < a[i+1] then
Begin
t:=a[i];
a[i]:=a[i+1];
a[i+1]:=t;
End;
Write('Sap xep giam dan ');
For i:=1 to n do write(a[i]:8);
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.
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 a: array[1..100] of longint;
i,n,max,min: longint;
begin
clrscr;
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:=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 trong mang la: ',max);
write('So nho nhat trong mang la: ',min);
readln
end.
Var a:array[1..200] of integer;
i,n,min:integer;
begin
write('Nhap so luong phan tu n = ');readln(n);
for i:=1 to n do
begin
write('Nhap phan tu thu ',i,' = ');readln(a[i]);
min:=a[1];
if a[i] < min then min:=a[i];
end;
write('So nho nhat la ',min);
readln;
end.
Bài này mới đúng nhé!
Var a:array[1..200] of integer;
i,n,min:integer;
begin
write('Nhap so luong phan tu n = ');readln(n);
for i:=1 to n do
begin
write('Nhap phan tu thu ',i,' = ');readln(a[i]);
end;
min:=a[1];
for i:=2 to n do
if a[i] < min then min:=a[i];
write('So nho nhat la ',min);
readln;
end.