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.
#include <bits/stdc++.h>
using namespace std;
long long a[100],n,i,s,t,ln,nn;
int main()
{
cin>>n;
for (i=1; i<=n; i++)
cin>>a[i];
s=1;
t=0;
ln=a[1];
nn=a[1];
for (i=1; i<=n; i++)
{
s=s*a[i];
t+=a[i];
ln=max(ln,a[i]);
nn=min(nn,a[i]);
}
cout<<s<<endl;
cout<<t<<endl;
cout<<ln<<endl;
cout<<nn;
return 0;
}
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.
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;
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);
write('Vi tri cua so lon nhat la: ');
for i:=1 to n do
if max=a[i] then write(i:4);
writeln;
dem:=0;
for i:=1 to n do
if max=a[i] then inc(dem);
writeln('So luong phan tu lon nhat trong day la: ',dem);
readln;
end.
uses crt;
var a:array[1..100000000] of int64;
n,i,d,max:longint;
begin
clrscr;
repeat
write('Nhap so luong phan tu: '); readln(n);
if (n<=0) and (n>688886) then writeln('NHAP LAI!');
until (n>0) and (n<=688886);
for i:=1 to n do
begin
write('Nhap phan tu thu ',i,': '); readln(a[i]);
end;
write('Day so vua nhap: ');
for i:=1 to n do write(a[i],' ');
max:=a[1];
for i:=1 to n do if a[i]>max then max:=a[i];
writeln;
writeln('So lon nhat: ',max);
write('Vi tri cua cac so lon nhat: ');
for i:=1 to n do if a[i]=max then begin write(i,' '); inc(d) end;
writeln;
writeln('So luong so lon nhat: ',d);
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 max,min,n,i,m,n: longint;
a: array[1..100] of longint
begin clrscr;
for i:=1 to n do begin
if(a[i] mod 2=0) then m:=m+a[i];
if(a[i] mod 2<>0) then n:=n+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('Tong cac phan tu chan: ',m);
Writeln('Tong cac phan tu le: ',n);
Writeln('Phan tu co gia tri lon nhat: ',max);
Writeln('Phan tu co gia tri nho nhat: ',min);
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.
#include <bits/stdc++.h>
using namespace std;
long long n,i,x,nn;
int main()
{
cin>>n;
nn=LLONG_MAX;
for (i=1; i<=n; i++)
{
cin>>x;
nn=min(nn,x);
}
cout<<nn;
return 0;
}
mình có bản Pascal không bạn