#include <iostream>
using namespace std;
int main()
{
double sum = 0, mas[3][3];
for (int j = 0; j < 3; j++)
for (int jj = 0; jj < 3; jj++)
cin >> mas[j][jj];
if (j == jj)
sum += mas[j][jj];
};
cout<<"\n"<<sum;
}
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
#include <iostream>
using namespace std;
int main()
{
double sum = 0, mas[3][3];
for (int j = 0; j < 3; j++)
for (int jj = 0; jj < 3; jj++)
{
cin >> mas[j][jj];
if (j == jj)
sum += mas[j][jj];
};
cout<<"\n"<<sum;
}