Last active
January 15, 2017 00:55
-
-
Save User0111/711fe2551beb0c66b98e6a82300006b8 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); | |
int m; | |
int n; | |
int k=-1; | |
System.out.println("Введіть розмірність масиву m*n:"); | |
m = scan.nextInt(); | |
n = scan.nextInt(); | |
int z = m; | |
int arr1 [][] = new int [m][n]; | |
int arr2 [] = new int [z]; | |
System.out.println("Введіть елементи масиву: "); | |
for(int i=0;i<m;i++){ | |
System.out.println(" "); | |
k++; | |
for(int j=0;j<n;j++) { | |
arr1[i][j]=scan.nextInt(); | |
arr2[k] = arr2[k] + arr1[i][j]; | |
} | |
} | |
System.out.print("Сума елементів по рядках :"); | |
for(k=0;k<m;k++){ | |
System.out.print(" , " + arr2[k]); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment