63 132
Assignments Done
99,1%
Successfully Done
In July 2018

Answer to Question #22173 in C++ for sushmita

Question #22173
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
Expert's answer

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]<<’,’;
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions