‹ Back to the paper
With reference to the program code given below, answer the following question: void dimen(int…
With reference to the program code given below, answer the following question:
void dimen(int n[][])
{
int p = 0;
for (int i = 0; i < n.length; i++)
for(int j = 0; j < n[0].length; j++)
{
if(i == 0 || i == n.length - 1 || j == 0 || j == n[0].length - 1)
p = p + n[i][j];
}
System.out.print(p);
}
What is the method dimen() performing?- (i)Finding the product of the boundary elements
- (ii)Finding the sum of the non-boundary elements
- (iii)Finding the sum of the boundary elements
- (iv)Finding the sum of the matrix elements
Answer
No answer yet.
From ISC 2022 Computer Science - Specimen paper (Semester 1), Paper 1, question 28(b).