You are using a version without Ads of this website. Please, consider donating:

### plz help me to understand this program

 ``1234567891011121314151617181920212223242526`` ``````int main() { int sumDigonal[3][3]; for (int i = 0; i < 3; i++){ for (int j = 0; j < 3; j++) { sumDigonal[i][j] = (i + 1) * (j + 1); } } for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { cout << sumDigonal[i][j] <<" "; } cout << endl; } for(int i = 0;i < 3;i++) { int sum = 0; sum += sumDigonal[i][i]; cout << sum << endl; } getch(); }``````
 ``1234567891011121314151617181920212223242526272829303132333435`` ``````#include using namespace std; int main() { int sumDigonal[3][3]; // Declaration of multi-dimensional array. for (int i = 0; // Definition of variable. i < 3; // Continue iterating while previously defined variable is less than 3. i++) { // Perform post increment operation on i. for (int j = 0; j < 3; // Continue iterating until condition evaluates to false. j++) { // Perform post increment operation on j. sumDigonal[i][j] = (i + 1) * (j + 1); // Assign element at index i, j to the result of the right // operand of the assignment operator. } } for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { cout << sumDigonal[i][j] << " "; // Write arguments to stream by invoking std::basic_ostream<>::operator<<(). // http://en.cppreference.com/w/cpp/io/basic_ostream/operator_ltlt } cout << endl; // Invoke std::endl with std::cout. Write newline character then flush stream. // http://en.cppreference.com/w/cpp/io/manip/endl } for(int i = 0; i < 3; i++) { int sum = 0; sum += sumDigonal[i][i]; // Assign sum to sum plus the element at sumDigonal[i][i]. cout << sum << endl; // Invoke std::basic_ostream<>::operator<<() member function on each argument. } }``````