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.
uses crt;
var a:array[1..100]of integer;
i,n,max,tam,j:integer;
begin
clrscr;
n:=100;
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);
for i:=1 to n-1 do
for j:=i+1 to n do
if a[i]<a[j] then
begin
tam:=a[i];
a[i]:=a[j];
a[j]:=tam;
end;
writeln('Day so giam dan la: ');
for i:=1 to n do
write(a[i]:4);
readln;
end.
Var a:array[1..1000] of integer;
i,m,tam:integer;
Begin
Write('m = ');readln(m);
For i:=1 to m do
Begin
Write('Nhap so thu ',i,' = ');readln(a[i]);
End;
For i:=1 to m do
If a[i] < a[i+1] then
Begin
tam:=a[i];
a[i]:=a[i+1];
a[i+1]:=tam;
End;
Write('Mang sau khi sap xep: ');
For i:=1 to m do
Write(a[i]:8);
Readln;
End.
#include <bits/stdc++.h>
using namespace std;
long long a[1000],i,n,t;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
for (i=1; i<=n; i++) cout<<a[i]<<" ";
cout<<endl;
t=0;
for (i=1; i<=n; i++) t+=a[i];
cout<<t;
return 0;
}
tham khảo:
uses crt;
var n,i:integer;
a:array[1..100] of integer;
begin
clrscr;
write(‘nhap so phan tu cua day:’);readln(n);
for i:=1 to n do
begin
write(‘a[‘,i,’]=’);readln(a[i]);
end;
writeln(‘day so da nhap:’);
for i:=1 to n do write(a[i]:2);
readln;
end.
Program HOC24;
var a: array[1..32000] of integer;
i,n: integer;
begin
write('Nhap so phan tu cua mang: '); readln(n);
for i:=1 to n do
begin
write('a[',i,']='); readln(a[i]);
end;
write('Mang vua nhap: ');
for i:=1 to n do write(a[i],' ');
writeln;
write('Cac so chan trong mang la: ');
for i:=1 to n do if a[i] mod 2=0 then write(a[i],' ');
writeln;
write('Cac so chinh phuong trong mang la: ');
for i:=1 to n do if if sqr(trunc(sqrt(a[i])))=a[i] then write(a[i],' ');
readln
end.
uses crt;
var n,i,s,t,j,max:longint;a,b:array[1..100] of longint;tbc:real;
function snt(n:longint):boolean;
var j:longint;
begin
for j:=2 to trunc(sqrt(n)) do
if n mod j=0 then exit(false);
exit(n>1);
end;
begin
readln(N);
for i:=1 to n do
begin
read (a[i]);
if snt(a[i])=true then
begin
j:=j+1;
b[j]:=a[i];
end;
end;
t:=b[1];
max:=b[1];
for i:=2 to j do
begin
if b[i]>max then max:=b[i];
t:=t+b[i];
write(b[i]:4);
end;
tbc:=t/j;
writeln(S);
writeln(tbc);
writeln(max);
readln;
end.
uses crt;
var a:array[1..100]of integer;
i,n,min,tam,j:integer;
begin
clrscr;
n:=100;
for i:=1 to 100 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('Gia tri nho nhat la: ',min);
for i:=1 to n-1 do
for j:=i+1 to n do
if a[i]>a[j] then
begin
tam:=a[i];
a[i]:=a[j];
a[j]:=tam;
end;
writeln('Day so tang dan la: ');
for i:=1 to n do
write(a[i]:4);
readln;
end.