#include<iostream>
#include<conio.h>
#define newline '\n'
using namespace std;

int main()
{
    //3D array 
    int arr[3][3];
    //Variables to stores sum and square of the elements
    int sum=0,squareofSum=0;
    cout<<"Enter elements of the array: "<<newline;
    for(int i=0;i<3;i++)
	   {
        for(int j=0;j<3;j++)
		 {
            cin>>arr[i][j];
         }
    }
    //Display all the elements on screen in a square format
    cout<<"all elements are "<<newline;
    for(int i=0;i<3;i++)
	    {
        for(int j=0;j<3;j++){
            cout<<arr[i][j]<<" ";
        }
        cout<<endl;
    }
    //Sum of all the major diagonal elements
    for(int i=0;i<3;i++)
	   {
        sum+=arr[i][i];
       }
    squareofSum=sum*sum;
    cout<<"square of sum of all major diagonal elements is "<<squareofSum<<newline;
    
    getch();
}
