#include <bits/stdc++.h>
using namespace std;
int main ()
{
int a[32];
int n,i,s;
cout<<"nhap so phan tu cua mang ";
cin>>n;
cout<<"nhap cac phan tu cua mang ";
for (i=1; i<=n; i++)
{
s=0;
cin>>a[i];
}
for(i=1; i<=a[i]; i++) s=s+i;
cout<<s;
return 0;
}
Program HOC24;
var i,n: integer;
a: array[1..1000] of integer;
t: longint;
begin
write('Nhap n: '); readln(n);
for i:=1 to n do
begin
write('Nhap so thu ',i,': '); readln(i);
end;
t:=0;
for i:=1 to n do t:=t+a[i];
write('Tong la: ',t);
readln
end.