viet chuong trinh nhap vao day so nguyen gom k phan tu IN RA MAN HINH CAC DAY SO VAU NHAP, in tra man hinh tong cac so nguyeh trong day so, in ra man hinh cac so nguyen lon hon 10, in ra man hinh cac so nguyen to trong day va tong cac so nguyen do
viet chuong trinh nhap vao day so nguyen gom k phan tu IN RA MAN HINH CAC DAY SO VAU NHAP, in tra man hinh tong cac so nguyeh trong day so, in ra man hinh cac so nguyen lon hon 10, in ra man hinh cac so nguyen to trong day va tong cac so nguyen do
program Day;
uses crt;
var A:array [1..500] of integer;
n,i,T,j,d,S: integer;
Begin
clrscr;
write(‘Nhap so phan tu: ‘); readln(k);
for i:=1 to k do
begin
write(‘A[‘,i,’]=’); readln(A[i]);
T:=T+A[i];
end;
write(‘Day vua nhap: ‘);
for i:=1 to k do write(A[i],’ ‘);
writeln;
writeln(‘Tong cac so trong day = ‘,T);
write(‘Cac so nguyen > 10: ‘);
for i:=1 to k do
if A[i]>10 then write(A[i],’ ‘);
writeln;
write(‘Cac so nguyen to trong day: ‘);
for i:=1 to k do
begin
d:=0;
for j:=1 to A[i] do
if A[i] mod j=0 then d:=d+1;
if d=2 then
begin
write(A[i],’ ‘);
S:=S+A[i];
end;
end;
writeln;
write(‘Tong cac so nguyen to trong day = ‘,S);
readln
End.