Problem Statement - 03A-2015
Write the definition of a function Change(int P[], int N) in C++, which should change all the multiples of 10 in the array to 10 and rest of the elements as 1. For example, if an array of 10 integers is as follows:
P[0] | P[1] | P[2] | P[3] | P[4] | P[5] | P[6] | P[7] | P[8] | P[9] |
100 | 43 | 20 | 56 | 32 | 91 | 80 | 40 | 45 | 21 |
After executing the function, the array content should be changed as follows:
P[0] | P[1] | P[2] | P[3] | P[4] | P[5] | P[6] | P[7] | P[8] | P[9] |
10 | 1 | 10 | 1 | 1 | 1 | 10 | 10 | 1 | 1 |
Solution
CSKC| Created: 8-Jan-2019 | Updated: 15-Jan-2019|CBSE12A-2015