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 .. 10] of integer;
i, n, d : integer;
begin
clrscr;
d := 0;
write('Nhap so luong phan tu : '); readln(n);
for i := 1 to n do
begin
write('Nhap so thu ', i ,' : ');
readln(A[i]);
if A[i] mod 2 = 0 then
d := d + 1;
end;
write('Cac phan tu vua nhap : ');
for i := 1 to n do write(A[i],' ');
writeln; write('Day co ', d ,' so chan ');
readln
end.
Program bt;
Uses crt;
Var a:array [1..1000] of integer;
n,i: integer;
Begin
Write( 'Moi nhap n');
Readln(n);
For i: = 1 to n do
Begin
Write( 'a[',i,']');
Readln(a[i]);
End;
For i: = 1 to n do
If a[i] mod 2=0 then write( 'Cac so chan la',a[i]);
Readln;
End.
uses crt;
var A : array [1 .. 10] of integer;
i, n, d : integer;
begin
clrscr;
d := 0;
write('Nhap so luong phan tu : '); readln(n);
for i := 1 to n do
begin
write('Nhap so thu ', i ,' : ');
readln(A[i]);
if A[i] mod 2 = 0 then
d := d + 1;
end;
write('Cac phan tu vua nhap : ');
for i := 1 to n do write(A[i],' ');
writeln; write('Day co ', d ,' so chan ');
readln
end.
Bài 1:
uses crt;
var a:array[1..200]of integer;
i,n,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
t:=0;
for i:=1 to n do
if a[i] mod 5=0 then t:=t+a[i];
writeln('Tong cac so chia het cho 5 la: ',t);
readln;
end.
Bài 2:
uses crt;
var st:string;
d,i:integer;
begin
clrscr;
write('Nhap xau:'); readln(st);
d:=length(st);
for i:=1 to d do
if st[i]=#32 then delete(st,i,1);
writeln(st);
readln;
end.
uses crt;
var a:array[1..100]of integer;
i,n,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
t:=0;
for i:=1 to n do
if a[i] mod 2<>0 then t:=t+a[i];
writeln('Tong cac so le la: ',t);
readln;
end.
uses crt;
var a:array[1..100]of integer;
i,n,k,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
write('Nhap k='); readln(k);
t:=0;
for i:=1 to n do
if a[i] mod k=0 then t:=t+a[i];
writeln(t);
readln;
end.
program BaiToanMang;
var
A: array[1..100] of integer;
N, i, demChan, tongLeChia3: integer;
begin
write('Nhap so phan tu cua mang: ');
readln(N);
writeln('Nhap cac phan tu cua mang: ');
for i := 1 to N do
begin
write('a[', i, ']= ');
readln(A[i]);
end;
tongLeChia3 := 0;
for i := 1 to N do
begin
if (A[i] mod 2 = 1) and (A[i] mod 3 = 0) then
begin
tongLeChia3 := tongLeChia3 + A[i];
end;
end;
writeln('Tong cac so le chia het cho 3: ', tongLeChia3);
demChan := 0;
for i := 2 to N do
begin
if (A[i] mod 2 = 0) and (i mod 2 = 1) then
begin
demChan := demChan + 1;
end;
end;
writeln('So phan tu chan o vi tri le: ', demChan);
writeln('Cac so chan chia het cho 5: ');
for i := 1 to N do
begin
if (A[i] mod 2 = 0) and (A[i] mod 5 = 0) then
begin
write(A[i], ' ');
end;
end;
end.
ko bt đúng ko ko dùng pascal nhiều
giúp mình với