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 TongLe;
var
N, i, Tong: integer;
A: array[1..50] of integer;
begin
write('Nhap so phan tu cua mang N (N <= 50): ');
readln(N);
for i := 1 to N do
begin
write('Nhap phan tu thu ', i, ': ');
readln(A[i]);
end;
Tong := 0;
for i := 1 to N do
begin
if(A[i] mod 2 <> 0) then
begin
Tong := Tong + A[i];
end;
end;
writeln('Tong cac so le trong mang A la: ', Tong);
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.
Program HOC24;
var d,i,n: integer;
a: array[1..1000] of integer;
begin
write('Nhap do dai cua day: '); readln(n);
for i:=1 to n do
begin
write('Nhap phan tu thu ',i,': '); readln(a[i]);
end;
d:=0;
for i:=1 to n do if a[i] mod 2=1 then d:=d+1;
write('Co tat ca ',d,' gia tri le');
readln
end.
uses crt;
var a:array[1..1000000] of longint;
n,i,s: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]);
if a[i] mod 2=1 then inc(s,a[i]);
end;
write('Tong cac so le: ',s);
readln;
end.
uses crt;
var a:array[1..1000000] of longint;
n,i,d: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]);
if a[i] mod 2=1 then inc(d);
end;
write('Co ',d,' gia tri la so le');
readln;
end.
Var a:array:[1..50] of integer;
i:integer;
s:longint;
Begin
For i:=1 to 50 do
Begin
Write('Nhap so thu ',i,' = ');readln(a[i]);
If a[i] mod 2 <> 0 then
s:=s+a[i];
End;
Write('Tong cac so le la: ',s);
Readln
End.
Var a:array:[1..1000] of integer;
i,n,max:integer;
Begin
Write('Nhap so luong phan tu n = ');readln(n);
For i:=1 to n do
Begin
Write('Nhap diem thu ',i,' = ');readln(a[i]);
End;
Write('Cac diem vua nhap la: ');
For i:=1 to n do
Write(a[i]:8);
writeln;
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 a:array[1..5] of integer;
i, j, t, dem : integer;
begin
clrscr;
writeln('nhap mang gom 5 so :');
for i:=1 to 5 do
begin
write('a[',i,']=');readln(a[i]);
end;
writeln('mang vua nhap la:');
for i:=1 to 5 do write(a[i]:3);
writeln;
dem:=0;
for i:=1 to 5 do
if a[i] mod 2 <>0 then
begin
dem:=dem+1;
writeln(a[i],' la phan tu le');
end;
if dem=0 then writeln('trong mang khong co phan tu le');
for i:=1 to 4 do
for j:=i+1 to 5 do
if a[i]>a[j] then
begin
t:=a[i];
a[i]:=a[j];
a[j]:=t;
end;
writeln('mang da duoc sap xep theo chieu tang dan la:');
for i:=1 to 5 do write(a[i]:3);
readln;
end.