Write a function in C++ which accepts an integer array and its size as argumentsand replaces elements having odd values with thrice its value and elementshaving even values with twice its value.Example: if any array of five elements initially contains the elements as3,4,5,16,9Then the function should rearrange the content of array as9,8,15,32,27
1
Expert's answer
2013-01-17T08:45:50-0500
void manipulate (int a[ ],int size) { for (i=0;i<size;i++) { if (a[i]%2= =1) a[i]=a[i]*3; else a[i]=a[i]*2; cout<<a[i]<<’,’; } }
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments