uses crt;
var a:array[1..50]of longint;
i,n,kt,j,t:longint;
begin
clrscr;
write('nhap so phan tu:'); 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]>1 then
begin
kt:=0;
for j:=2 to a[i]-1 do
if a[i] mod j=0 then kt:=1;
if kt=0 then t:=t+a[i];
end;
writeln('tong cac so nguyen to trong day la: ',t);
readln;
end.
program developer;
uses crt;
var n,i,u,tong,tongu,tongngto,x: integer;
a: array [1..50] of integer;
begin
clrscr;
repeat
write('Nhap so phan tu: ');readln(n);
if n > 50 then
begin
write('So lon hon 50. Hay nhap lai');
delay(2000);
clrscr;
end;
until n <= 50;
for i:= 1 to n do
begin
write('Phan tu thu ',i,': ');
readln(a[i]);
end;
tong:= 0;
for i:= 1 to n do
tong:= tong + a[i];
writeln('Tong cua ',n,' phan tu la: ',tong);
tongngto:= 0;
for i:= 1 to n do
begin
tongu:= 0;
for u:= 1 to a[i] do
if a[i] mod u = 0 then tongu:= tongu + u;
if tongu = (a[i] + 1) then tongngto:= tongngto + a[i];
end;
write('Tong cac phan tu nguyen to la: ',tongngto);
readln
end.