In: Computer Science
1. Given an array of integers a dimension n. If the array
contains the same number of even and odd elements get (a1 + an) (a2
+ an-1) ...
2. Given an array of integers dimension n. All array elements with
even numbers preceding the first element to the maximum, multiplied
by the maximum.
3. Given an array of dimension n. Insert after each zero element of
the element in the middle (or the amount of secondary elements for
even n). In the resulting array to remove the first negative and
the second positive elements. Optional array is not used.
4. Dana matrix of dimension nxn. Get a one-dimensional array that
stores the sum of the elements descending diagonal matrix.
1.
The code is provided below in c++
The output is shown below for array size 6(even size)
2.
The code is provided below in c++
Here, the first 4 elements are initial array elements and remaining are modified array elements and output is shown below:
4.
The code is as follows
Output is as follows: