Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MatricaShume {
- public static void main(String[] args) {
- int m1[] = {76, 84, 12, 1, 3, 88, 4};
- int m2[] = {20, 27, 4, 6, 19, 50, 12};
- int shM1 = 0, shM2 = 0;
- // Shuma e matrices 1
- for (int i = 0; i < m1.length; i++) {
- shM1 += m1[i];
- }
- // Shuma e matrices 2
- for (int j = 0; j < m2.length; j++) {
- shM2 += m2[j];
- }
- // Shuma e matricave
- System.out.println("Shuma e matrices se pare: " + shM1);
- System.out.println("Shuma e matrices se dyte: " + shM2);
- System.out.println("Shuma e 2 matricave: " + (shM1 + shM2));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement