Computer Science, asked by SƬᏗᏒᏇᏗƦƦᎥᎧƦ, 1 month ago

If arrays M and M + N are shown below, write a program in Java to find the array N.
[tex]\bf{M = }\left[
\ \textless \ br /\ \textgreater \ \begin{array}{c c c}
\ \textless \ br /\ \textgreater \ - 1 & 0 & 2 \\
\ \textless \ br /\ \textgreater \ - 3 & - 1 & 6 \\
\ \textless \ br /\ \textgreater \ 4 & 3 & - 1
\ \textless \ br /\ \textgreater \ \end{array}
\ \textless \ br /\ \textgreater \ \right][/tex]
[tex]\bf{ And \: M+N = }\left[
\ \textless \ br /\ \textgreater \ \begin{array}{c c c}
\ \textless \ br /\ \textgreater \ - 6 & 9& 4 \\
\ \textless \ br /\ \textgreater \ 4 & 5 & 0 \\
\ \textless \ br /\ \textgreater \ 1& - 2 & - 3
\ \textless \ br /\ \textgreater \ \end{array}
\ \textless \ br /\ \textgreater \ \right][/tex]

Answers

Answered by Anonymous
4

Answer:

public class KboatSubtractDDA

{

   public static void main(String args[]) {

       

       int arrM[][] = {

           {-1, 0, 2},

           {-3, -1, 6},

           {4, 3, -1}

       };

       

       int arrSum[][] = {

           {-6, 9, 4},

           {4, 5, 0},

           {1, -2, -3}

       };

       

       int arrN[][] = new int[3][3];

       

       for (int i = 0; i < 3; i++) {

           for (int j = 0; j < 3; j++) {

               arrN[i][j] = arrSum[i][j] - arrM[i][j];

           }

       }

       

       System.out.println("Array N:");

       for (int i = 0; i < 3; i++) {

           for (int j = 0; j < 3; j++) {

               System.out.print(arrN[i][j]);

               System.out.print(' ');

           }

           System.out.println();

       }

   }

}

Answered by hardiksah5447
0
  • Given an array of size n, find all elements in array that appear more than n/k times. For example, if the input arrays is {3, 1, 2, 2, 1, 2, 3, 3} and k is 4, then the output should be [2, 3]. Note that size of array is 8 (or n = 8), so we need to find all elements that appear more than 2 (or 8/4) times. There are two elements that appear more than two times, 2 and 3.
  • Explanation:

"Plz Mark me as brainliest"

Similar questions