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 max_min;
uses crt;
var i,n,max,min:integer;
a:array[1..100]of integer;
begin
clrscr;
write('nhap n:');readln(n);
for i:=1 to n do
begin
write('a[',i,']=');readln(a[i]);
end;
writeln('day vua nhap la:');
for i:=1 to n do
write(a[i]:3);
writeln;
max:=a[1];min:=a[1];
for i:=1 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: ',max,' gia tri nho nhat: ',min);
readln;
end.
uses crt;
var a:array[1..1000000] of longint;
n,i,max,min: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]);
end;
write('Day so vua nhap: ');
for i:=1 to n do write(a[i],' '); writeln;
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('GTLN: ',max);
writeln('GTNN: ',min);
readln;
end.
var a:array[1..100]of longint;
n,i,max:longint;
begin
read(n); {nhập số phần tử trong dãy}
for i:=1 to n do read(a[i]); {nhập giá trị các phần tử}
max:=a[1]; {gán max=giá trị của phần tử thứ nhất}
for i:=2 to n do
if a[i]>max then max:=a[i];
write('gia tri lon nhat trong day la: ',max);
end.
Ấn đồng thời alt+f5 để xem kq nhé!!!
Đánh giá zùm nhe :)
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('So lon nhat la: ',max);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long a[1000],i,n,ln,nn,t;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
t=0;
for (i=1; i<=n; i++) t+=a[i];
ln=a[1];
nn=a[1];
for (i=2; i<=n; i++)
{
ln=max(ln,a[i]);
nn=min(nn,a[i]);
}
cout<<t<<endl;
cout<<ln<<" "<<nn;
return 0;
}
Var a:array[1..200] of integer;
i,n,s,max,min:integer;
Begin
Write('Nhap so luong phan tu n = ');readln(n);
For i:=1 to n do
Begin
Write('Nhap so thu ',i,' = ');readln(a[i]);
End;
s:=a[1];
max:=a[1];
min:=a[1];
For i:=2 to n do
Begin
s:=s+a[i];
If a[i] > max then max:=a[i];
If a[i] < min then min:=a[i];
End;
Writeln('Tong la ',s);
Writeln('So lon nhat la ',max);
Write('So nho nhat la ',min);
Readln;
End.
Program HOC24;
var i,n,max: integer;
a: array[1..1000] of integer;
begin
write('Nhap N: '); readln(n);
for i:=1 to n do
begin
write('Nhap so thu ',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.
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.
uses crt; var i,n,a,b, uc,bcnn:integer ;
c:array[1..100] of integer;
{--- CTC tim UCLL hai so} function ucln(a,b:integer):integer;
var r:integer;
begin r:=a mod b;
while r<>0 do begin a:=b; b:=r; r:= a mod b;
end;
ucln:=b;
end;
{--- CTC chinh----} begin Write('n= ');
readln(n);
for i:=1 to n do begin write('c[',i,']=');
readln(c[i]);
end;
for i:= 1 to n do
Write(c[i]:3);
writeln;
uc:=ucln(c[1], c[2]);
bcnn:=(c[1]*c[2])div uc;
for i:=3 to n do begin uc:=ucln(uc,c[i]);
bcnn:= bcnn*c[i] div uc;
end;
Writeln('bcnn =',bcnn); readln; end.
var i,n,min,max:integer;
a:array[1..1000] of integer;
begin
Write('n=');read(n);
for i:=1 to n do
Read(a[i]);
i:=1;
max:=0;
min:=a[i];
while i<n do
Begin
if a[i] > max then max:=a[i];
if a[i] <min then min:=a[i];
i:=i+1;
end;
writeln('Gia tri LN la:',max);
writeln('Gia tri NN la:',min);
readln;
end.
Var a:array:[1..100] of integer;
i,max:integer;
Begin
For i:=1 to 100 do
Begin
Write('Nhap so thu ',i,' = ');readln(a[i]);
End;
max:=a[1];
For i:=2 to n do
If a[i] > max then max:=a[i];
write('So lon nhat la ',max);
Readln
End.
Uses crt;
var i,n,max; longint;
a: array[1..100] of longint;
begin clrscr;
readln(n);
for i:=1 to n do read(n); readln;
max:=a[1];
for i:=1 to n do if(max<a[i]) then max:=a[i];
write('So nguyen lon nhat la: ',max);
readln;
end.
a) var a:array[1..1000] of integer;
i,k:integer;
p:longint;
begin
write('k = ');readln(k);
p:=1;
for i:=1 to k do
begin
write('Nhap so thu ',i,' = ');readln(a[i]);
if a[i]<30 then p:=p*a[i];
end;
write('Tich la ',p);
readln
end.
b)
var a:array[1..1000] of integer;
i,k:integer;
s:longint;
begin
write('k = ');readln(k);
for i:=1 to k do
begin
write('Nhap so thu ',i,' = ');readln(a[i]);
if a[i]<100 then s:=s+a[i];
end;
write('Tong la ',s);
readln
end.
Program HOC24;
var i,n,max: integer;
a: array[1..1000] of integer;
begin
write('Nhap N: '); readln(n);
for i:=1 to n do
begin
write('Nhap so thu ',i,': '); readln(a[i]);
end;
max:=a[1];
for i:=2 to n do if a[i]>max then max:=a[i];
write('So lon nhat la: ',max);
readln
end.