Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

What will be the output of following code? int [ ] [ ] twoDArray { 1 , 2 , 3 } , { 4 ,

What will be the output of following code?
int [][] twoDArray
{1,2,3},
{4,5,6},
{7,8,9}
};
int evensum =0;
for (int i=0; i twoDArray. length; i++){
for (int j=0;j twoDArray [i]. length; j++){
if (twoDArray[i][j]%2==0){
evenSum += twoDArray [i][j];
}
}
}
System.out.println("Sum of all even numbers: "+ evenSum);
Sum of all even numbers: 22
Sum of all even numbers: 18
Sum of all even numbers: 24
Sum of all even numbers: 20
AGU
What is the repeating pattern?
Assumption
Initial state: QAQBQCQDQE=00000
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions