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]<<’,’; } }
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment