0% found this document useful (0 votes)
8 views2 pages

Rhatj

The document outlines various operations that can be performed on 2D arrays, including matrix operations, transposition, finding largest and smallest values, counting occurrences, and element searching. It also describes tasks such as checking matrix equality, swapping elements, and finding and replacing values. Additionally, it provides a specific example using a matrix to calculate differences between elements in a structured manner.

Uploaded by

pone6489
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

Rhatj

The document outlines various operations that can be performed on 2D arrays, including matrix operations, transposition, finding largest and smallest values, counting occurrences, and element searching. It also describes tasks such as checking matrix equality, swapping elements, and finding and replacing values. Additionally, it provides a specific example using a matrix to calculate differences between elements in a structured manner.

Uploaded by

pone6489
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

1.

Matrix Operations: Perform operations such as addition, subtraction,


multiplication, and division on two matrices represented in 2D arrays.

2. Matrix Transposition: Given a 2D array representing a matrix, transpose the


matrix by swapping the elements from its rows with its columns.

3. Finding Largest and Smallest: Find the largest and smallest value in a 2D array
by iterating through all elements and comparing them.

4. Counting Occurrences: Count the number of occurrences of a specific element in a


2D array by iterating through all elements and comparing them with the target
value.

5. Finding Sum and Average of Row and Column: Calculate the sum of each row or
column in a 2D array by iterating through the elements and accumulating the values.

6. Element Searching: Search for a specific element in a 2D array and return its
position (row and column indices) if found.

7. Checking Matrix Equality: Determine whether two matrices are equal by comparing
their corresponding elements.

8. Swapping Elements: Given two 2D arrays, swap the corresponding elements between
these arrays.

9. Find and Replace: Find all occurrences of a given target element in the matrix
and replace them with new element.

10. Square and Cube: Print the square of all even elements and cube of all odd
elements in the matrix.

11. From the following matrix,

int[,] MyArray = {
{6,5},
{1,4},
{5,8},
{9,2},
{7,10}
};

write a program that gets the difference of the last element of the last row (10)
and the first element of the first row (6). Next, it gets the difference by
subtracting the last element of the first row (5) from the first element of the
last row (7), and so on. Repeat this until you subtract the first element of the
third row (5) from the last element of third row (8).

--------
Ouput:
--------

10 - 6 = 4
7 - 5 = 2
2 - 1 = 1
9 - 4 = 5
8 - 5 = 3
Note: Use only the 2d array being given. No need to declare any additional 1D or 2D
array.

You might also like