Problem Statement - 03A
Write the definition of a function Alter(int A[], int N) in C++, which should change all the multiples of 5 in the array to 5 and rest of the elements as 0. For example, if an array of 10 integers is as follows:
A[0] | A[1] | A[2] | A[3] | A[4] | A[5] | A[6] | A[7] | A[8] | A[9] |
55 | 43 | 20 | 16 | 39 | 90 | 83 | 40 | 48 | 25 |
After executing the function, the array content should be changed as follow:
A[0] | A[1] | A[2] | A[3] | A[4] | A[5] | A[6] | A[7] | A[8] | A[9] |
5 | 0 | 5 | 0 | 0 | 5 | 0 | 5 | 0 | 5 |
Solution
CSKC| Created: 5-Jan-2019 | Updated: 5-Jan-2019|CBSE12D-2015