Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.72 KB | None | 0 0
  1. public class matricat {
  2.  
  3.     public static void main(String[] args) {
  4.  
  5.         int[][] M = {
  6.                 {4, 33, 47, 2, 61, 5},
  7.                 {16, 24, 12, 1, 3, 8}
  8.         };
  9.  
  10.         int shumaM = 0, elM = 0;
  11.         long prodhimiM = 1;
  12.  
  13.         // Shuma & prodhimi i matrices
  14.         for (int i = 0; i < M.length; i++) {
  15.             for (int j = 0; j < M[i].length; j++) {
  16.                 shumaM += M[i][j];
  17.                 prodhimiM *= M[i][j];
  18.                 elM++;
  19.             }
  20.         }
  21.  
  22.         System.out.println("Shuma e matrices eshte: " + shumaM);
  23.         System.out.println("Prodhimi i matrices eshte: " + prodhimiM);
  24.         System.out.println("Elementet e matrices jane: " + elM);
  25.  
  26.     }
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement