Answer the question
In order to leave comments, you need to log in
Error related to int main()?
#include <iostream>
using namespace std;
int main()
{
int n, m, t;
int sum1 = 0, sum2 = 0;
cin >> n;
int table[n][n];
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
cin >> table[i][j];
if (i == j)
{
sum1 = sum1 + table[i][j];
}
else if (i + j == n-1)
{
sum2 = sum2 + table[i][j];
}
}
}
cout << sum1 << " " << sum2 ;
return 0;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question