Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A.Write a looping structure (using java- 100X100 array) to process the elements

ID: 3781455 • Letter: A

Question

A.Write a looping structure (using java- 100X100 array) to process the elements on the main diagonal of a (i.e. only the elements on the diagonal starting from the top left and proceeding to thebottom right).
B.Write a looping structureusing( java- 100X100 array) to process the elements on the back diagonal of a (i.e. from top right to bottom left).
C.Write a looping structureusing( java- 100X100 array) to process the elements in the lower triangular portion of a (i.e. the first element in the first row, the first two elements in the second row,etc.)
D.Write a looping structure(using java- 100X100 array)  to process the nine elements centered on (x,y) (i.e. (x,y) and the eight neighboring cells one row and/or column away from (x,y)).

Explanation / Answer

a)

for(int i=0;i<100;i++)

{

   for(int j=0;j<100;j++)

    {

     System.out.print(" " +arr[i][j]);

         

     }

     System.out.println(" ");

    }

System.out.println("Diagonal elements are: ");

for(int i=0;i<100;i++)

{

   for(int j=0;j<100;j++)

    {

     if(i!=j)

     System.out.print(" ");

     else

     System.out.println(" "+arr[i][j]);

     }

    }

}

}

b)

for(int i=100;i<100;i++)

{

   for(int j=0;j<100;j++)

    {

     System.out.print(" " +arr[i][j]);

         

     }

     System.out.println(" ");

    }

System.out.println("Diagonal elements are: ");

for(int i=0;i<100;i++)

{

   for(int j=99;j>=0;j--)

    {

     if(i!=j)

     System.out.print(" ");

     else

     System.out.println(" "+arr[i][j]);

     }

    }

}

}

c)

I can't understand what do you understand by d problem. Please comment this problem in the comment section below and I will try to help. These three parts for which I have provided the solution; if any doubt you have or you meant something else by looping structure please let me know in the comment section below. I'll help.