Problem Statement - 03A
Write the definition of a function AddUp(int Arr[], int N) in C++, in which all even positions (i.e. 0,2,4,…) of the array should be added with the content of the element in the next position and odd positions (i.e. 1,3,5,…) elements should be incremented by 10.
Example: if the array Arr contains
23 | 30 | 45 | 10 | 15 | 25 |
Then the array should become
53 | 40 | 55 | 20 | 40 | 35 |
NOTE:
- The function should only alter the content in the same array.
- The function should not copy the altered content in another array.
- The function should not display the altered content of the array.
- Assuming, the Number of elements in the array are Even.
Solution
CSKC| Created: 3-Jan-2019 | Updated: 27-Mar-2019|CBSE12A-2017