#include <bits/stdc++.h>
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;
s += a[i][j];
cout << s << endl;
return 0;
}
#include <stdio.h>
scanf("%d", &n);
scanf("%d", &a[i][j]);
printf("%d\n", s);
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Verified answer
Код (C++)
#include <bits/stdc++.h>
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;
return 0;
}
Код (C)
#include <stdio.h>
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;
}