After multiplying all even numbers by 10, write code to sum all elements in each row and print the results. code used to multiply all even number by 10 below import java.util.Random; public class Main {     public static void main(String[] args) {         Random random = new Random();         // Generating a 5x5 matrix         int[][] matrix = new int[5][5];         for (int i = 0; i < matrix.length; i++) {             for (int j = 0; j < matrix[i].length; j++) {                 matrix[i][j] = random.nextInt(101); // from 0 to 100             }         }         // Printing the original matrix         System.out.println("Original matrix: ");         for (int i = 0; i < matrix.length; i++) {             for (int j = 0; j < matrix[i].length; j++) {                 System.out.print(matrix[i][j] + " ");             }             System.out.println();         }         // Multiplying even numbers by 10         for (int i = 0; i < matrix.length; i++) {             for (int j = 0; j < matrix[i].length; j++) {                 if (matrix[i][j] % 2 == 0) {                     matrix[i][j] *= 10;                 }             }         }         // Printing the modified matrix         System.out.println("\nModified matrix: ");         for (int i = 0; i < matrix.length; i++) {             for (int j = 0; j < matrix[i].length; j++) {                 System.out.print(matrix[i][j] + " ");             }             System.out.println();         }     }

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

After multiplying all even numbers by 10, write code to sum all elements in
each row and print the results.

code used to multiply all even number by 10 below

import java.util.Random;

public class Main {
    public static void main(String[] args) {
        Random random = new Random();

        // Generating a 5x5 matrix
        int[][] matrix = new int[5][5];
        for (int i = 0; i < matrix.length; i++) {
            for (int j = 0; j < matrix[i].length; j++) {
                matrix[i][j] = random.nextInt(101); // from 0 to 100
            }
        }

        // Printing the original matrix
        System.out.println("Original matrix: ");
        for (int i = 0; i < matrix.length; i++) {
            for (int j = 0; j < matrix[i].length; j++) {
                System.out.print(matrix[i][j] + " ");
            }
            System.out.println();
        }

        // Multiplying even numbers by 10
        for (int i = 0; i < matrix.length; i++) {
            for (int j = 0; j < matrix[i].length; j++) {
                if (matrix[i][j] % 2 == 0) {
                    matrix[i][j] *= 10;
                }
            }
        }

        // Printing the modified matrix
        System.out.println("\nModified matrix: ");
        for (int i = 0; i < matrix.length; i++) {
            for (int j = 0; j < matrix[i].length; j++) {
                System.out.print(matrix[i][j] + " ");
            }
            System.out.println();
        }
    }

computer science proj X b Answered: . Implement X
← → C
CPS 2231 Assignment2.pdf
44°F
Mostly cloudy
kean.instructure.com/courses/12224/assignments/56660
Assignments
Lab 3: 1-D Array Oper X
H
Assignment 2: 1D & 2 x
O Search
Course Modules: Libra X
a
Page < 2
(3) After multiplying all even numbers by 10, write code to sum all elements in
each row and print the results.
Sample output:
Sum for row 0 is
1783
Sum for row 1 is 2228
Sum for row 2 is 2037
Sum for row 3 is 2148
Sum for row 4 is 1623
Unit 4 AS1: Assignmer X
> of 3
+
G☆
Download
R=J
i Info
ZOOM +
J
X Close
4) O
3:54 PM
2/10/2023
X
Transcribed Image Text:computer science proj X b Answered: . Implement X ← → C CPS 2231 Assignment2.pdf 44°F Mostly cloudy kean.instructure.com/courses/12224/assignments/56660 Assignments Lab 3: 1-D Array Oper X H Assignment 2: 1D & 2 x O Search Course Modules: Libra X a Page < 2 (3) After multiplying all even numbers by 10, write code to sum all elements in each row and print the results. Sample output: Sum for row 0 is 1783 Sum for row 1 is 2228 Sum for row 2 is 2037 Sum for row 3 is 2148 Sum for row 4 is 1623 Unit 4 AS1: Assignmer X > of 3 + G☆ Download R=J i Info ZOOM + J X Close 4) O 3:54 PM 2/10/2023 X
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Arrays
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education