Take an n x n matrix and create a new n-1 x n- 1 matrix


You need to prepare a matrix.

Program- Take an N x N matrix, and create a new, (N-1) x (N- 1), matrix with each element being the sum of four nearby elements. You need to figure out a way to break the matrix up into squares and iterate through the matrix, while staying within its bounds. For example:

0 1 2

3 4 5

6 7 8

Result:

8 12

20 24

You have to implement an iterative calculate_result() function that takes the original N x N array and fills the result array with the correct sum of the four neighboring elements, and also, you require a recursive_calculate_result() function that does the same thing as calculate_result but recursively.

Requirements for your program:

-  Read the N value from the user

- Initialize the N x N array

- Print the initial array and the resulting array

- All functions (including main) must not be more than 15 lines of code!!!

Can someone please help me. I don't know what to do to write this C program.

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Take an n x n matrix and create a new n-1 x n- 1 matrix
Reference No:- TGS0965330

Expected delivery within 24 Hours