Код (C++)
#include
using namespace std;
int main() {
int n;
cin >> n;
int a[n][n];
for (int i = 0; i < n; ++i)
for (int j = 0; j < n; ++j)
cin >> a[i][j];
int s = 0;
for (int i = 0; i < n; ++i)
for (int j = 0; j < n; ++j)
s += a[i][j];
cout << s << endl;</p>
return 0;
}
Код (C)
#include
int main() {
int n;
scanf("%d", &n);
int a[n][n];
for (int i = 0; i < n; ++i)
for (int j = 0; j < n; ++j)
scanf("%d", &a[i][j]);
int s = 0;
for (int i = 0; i < n; ++i)
for (int j = 0; j < n; ++j)
s += a[i][j];
printf("%d\n", s);
return 0;
}