Page 1 of 1

Given a small square piece of paper, it can be folded horizontally and they vertically as shown in the figure: A B C D L

Posted: Thu Jun 02, 2022 8:26 am
by answerhappygod
Given A Small Square Piece Of Paper It Can Be Folded Horizontally And They Vertically As Shown In The Figure A B C D L 1
Given A Small Square Piece Of Paper It Can Be Folded Horizontally And They Vertically As Shown In The Figure A B C D L 1 (447.35 KiB) Viewed 13 times
Need code in C.
Given a small square piece of paper, it can be folded horizontally and they vertically as shown in the figure: A B C D Let N be a positive even number. Imagine an N x N square matrix. The matrix can also be folded the way it was described above. The folded piece of matrix we thus obtain is what we shall call the 'Quarter matrix'. For example consider this matrix: 1 0 6 3 7 4 5 2 1 4 6 3 7 5 2 0 2 7 5 3 0 1 6 4 0 4 6 7 5 2 3 1 37 2 - 2 horizontal 3 4 7 2 6 5 10 2 1 6 3 7 5 4 0 7 3 4 1 0 2 5 6 By folding it horizontally (over the axis passing through the middle) we get: 3 11 10 9 11 2 4 6 5 11 12 5 6 6 7 4 35 12 6 14 10 60 83 10 4 7 6 10 8
(notice: 3 + 0 = 3; 4 + 4 = 11; 4 + 6 = 10; etc..) By folding it vertically (over the axis passing through the middle) finaly we get the quarter matrix: 9 15 12 20 9 18 18 11 3 11 22 20 16 13 16 11 Write a C program that scans an N x N matrix (N is even) from the user and outputs the elements of the quarter matrix. Example 1: Input: 8 11000-1 -11 -1 -1 0-1 -1 -1 1-1 -1 1-1 1-100-1 1-1110001 0-11-101 10 01-1101-10 000-11-100 -100-10-101 Ouput: 0-11-1 01-11 000-1 -100-1 Explanation: Self evident. Where: 8 is the order of the matrix N elements of the matirx.