Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random;
- public class Zadaca {
- public static void main(String[] args) {
- int[][] mat = new int[5][10];
- Random random = new Random();
- for(int i = 0; i < 5; i++) {
- for(int j = 0; j < 10; j++) {
- mat[i][j] = random.nextInt(10);
- }
- }
- for(int i = 0; i < 5; i++) {
- for(int j = 0; j < 10; j++) {
- System.out.print(mat[i][j] + " ");
- }
- System.out.println();
- }
- for(int i = 0; i < 5; i++) {
- int sum = 0;
- for(int j = 0; j < 10; j++) {
- sum += mat[i][j];
- }
- System.out.println("The sum of numbers in row " + i + " is: " + sum);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement