Advertisement
DanikYakush

Task36

Jul 7th, 2022
826
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.49 KB | None | 0 0
  1. public static double task36(double[][] a) {
  2.         double sum = 0;
  3.         int ind = -1;
  4.         for (int i = 0; i < a[0].length; ++i) {
  5.             double tmpSum = 0;
  6.             for (int j = 0; j < a.length; ++j) {
  7.                 tmpSum += a[j][i];
  8.             }
  9.             if (tmpSum > sum) {
  10.                 sum = tmpSum;
  11.                 ind = i;
  12.             }
  13.         }
  14.         System.out.println("Colomn with index " + ind + " have the biggest sum");
  15.         return sum;
  16.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement