InterviewSolution
Saved Bookmarks
| 1. |
Write a function REASSIGN() in C++, which accepts an array of integer and its size as parameters and divide allthose array elements by 5 which are divisible by 5 and multiply other array element by 2. Sample Input Data of the arrayA[0]A[1]A[2]A[3]A[4]2012156032Content of the array after calling REASSIGN() functionA[0]A[1]A[2]A[3]A[4]42431264 |
|
Answer» void REASSIGN (int Arr[ ], int Size) { for (int i=0;i<Size;i++) if (Arr[i]%5==0) Arr[i]/=5; else Arr[i]*=2; } |
|