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,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.
Bài 1:
uses crt;
var a:array[1..100]of integer;
i,n,tam,j: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-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;
for i:=1 to n do
write(a[i]:4);
readln;
end.
program PSMCG;
uses crt;
const N = 5;
type MangA = array[1..N] of integer;
var A: MangA;
i, max, min, sum: integer;
begin
for i := 1 to N do
begin
write('Nhap phan tu A[', i, ']: ');
readln(A[i]);
end;
writeln('Mang A: ');
for i := 1 to N do
begin
write(A[i], ' ');
end;
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('Gia tri lon nhat la: ', max);
writeln('Gia tri nho nhat la: ', min);
sum := 0;
for i := 1 to N do
begin
sum := sum + A[i];
end;
writeln('Tong gia tri trong mang A la: ', sum);
readln;
end.
Bài 1
Var a:array:[1..99] of integer;
i,n:integer;
s:longint;
Begin
Repeat
Write('n = ');readln(n);
Until (n > 0) and (n < 100);
For i:=1 to n do
Begin
Write('Nhap diem thu ',i,' = ');readln(a[i]);
if a[i] mod 2 = 0 then s:=s+a[i];
End;
Write('Cac so vua nhap la: ');
For i:=1 to n do
Write(a[i]:8);
writeln;
write('Tong cac so chan la ',s);
Readln
End.
Bài 2
Var a:array:[1..99] of integer;
i,n:integer;
s:longint;
Begin
Repeat
Write('n = ');readln(n);
Until (n > 0) and (n < 100);
For i:=1 to n do
Begin
Write('Nhap diem thu ',i,' = ');readln(a[i]);
if a[i] mod 2 <> 0 then s:=s+a[i];
End;
Write('Cac so vua nhap la: ');
For i:=1 to n do
Write(a[i]:8);
writeln;
write('Tong cac so le la ',s);
Readln
End.
Program HOC24;
var a: array[1..50] of integer;
i,n: byte;
t: longint;
begin
write('Nhap N: '); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
write('Cac phan tu chan trong mang la: ');
for i:=1 to n do
if a[i] mod 2=0 then
begin
write(a[i],' ');
t:=t+a[i];
end;
writeln;
write('Tong cac phan tu chan trong day la: ',t);
readln
end.
Câu 1:
uses crt;
var a:array[1..100]of integer;
i,n,s:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
s:=0;
for i:=1 to n do
s:=s+a[i];
writeln(s);
readln;
end.
Câu 2:
uses crt;
var a:array[1..100]of integer;
i,n,j,tam: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-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;
for i:=1 to n do
write(a[i]:4);
readln;
end.
program TT;
uses CRT;
Var i,n:integer;
P:longint; S:Real;
begin
Write('Nhap N: '); Readln(N);
S:=0;
P:=1;
For i:=1 to N do
begin P:=P*i; S:=S+1/P; end;
Writeln('Tong S= ',S:5:3);
Readln
End.
làm cái j thế?