chce obliczyć dwie sumy a on dodaje mi dwie sumy
np dla
2
2 1 2
3 1 7 8
powinno być
1+2=3
1+7+8=16
A program mi liczy
1 +1+1+7+8=19
1 +1+1+7+8=19
jak go zmienić (bez tablic)
#include <iostream>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int d;
cin >> d;
int suma=0;
for(int i=0; i<d; i++)
{
int n;
cin >> n;
for(int j=0; j<n; j++)
{
int a;
cin >> a;
suma += a;
}
}
for(int i=0; i<d; i++)
{
cout <<suma << endl;
}
system("pause");
return 0;
}