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; }
1 Réponse
+ 1
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++ ){
sum += aza[i][j];
}
}