-
-
Save FreeFly19/5450e2ee1297801477f8e1916b8474db to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.company; | |
import java.util.Scanner; | |
public class Main { | |
public static void main(String[] args) { | |
Scanner scan = new Scanner(System.in); | |
System.out.println("Введіть розмірність масиву m*n:"); | |
int m = scan.nextInt(); | |
int n = scan.nextInt(); | |
int[][] arr1 = new int[m][n]; | |
int[] arr2 = new int[m]; | |
System.out.println("Введіть елементи масиву: "); | |
for(int i=0;i<m;i++){ | |
System.out.println(" "); | |
for(int j=0;j<n;j++) { | |
arr1[i][j]=scan.nextInt(); | |
arr2[i] = arr2[i] + arr1[i][j]; | |
} | |
} | |
System.out.print("Сума елементів по рядках :"); | |
for(int i=0;i<m;i++){ | |
System.out.print(" , " + arr2[i]); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment