Skip to content

Instantly share code, notes, and snippets.

@FreeFly19
Forked from User0111/homeWork3(5*)
Last active January 15, 2017 00:59
Show Gist options
  • Save FreeFly19/5450e2ee1297801477f8e1916b8474db to your computer and use it in GitHub Desktop.
Save FreeFly19/5450e2ee1297801477f8e1916b8474db to your computer and use it in GitHub Desktop.
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