Input First line N (1<=N<=100). Then NxN table is given(all number are integers) Output The total sum of element that are locate | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Input First line N (1<=N<=100). Then NxN table is given(all number are integers) Output The total sum of element that are locate

What is wrong? #include <iostream> using namespace std ; int main (){ int n ,sum ; cin >> n ; int aza[100][100]; for (int i=0;i<n;i++){ for(int j=0;j<n;j++){ cin >> aza[i][j]; } } for(int i = 0; i < n; i++){ for(int j = 1; j > i; j++ ){ sum += aza[i][j]; } } cout << sum; }

3rd Oct 2020, 5:02 AM
Azat Malgazhdar
Azat Malgazhdar - avatar
1 Answer
+ 1
for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++ ){ sum += aza[i][j]; } }
3rd Oct 2020, 7:22 AM
JaScript
JaScript - avatar