wap in c++ which accept a integer array and its size as
argument and replaces element having even values with its
half and element having odd values with twice its value



wap in c++ which accept a integer array and its size as argument and replaces element having even..

Answer / ashish

void update(int arr[], int size)
{
for(int i =0;i<size;i++)
{
if(arr[i]%2) arr[i] *= 2;
else arr[i] /= 2;
}

}

Is This Answer Correct ?    14 Yes 11 No

Post New Answer

More STL Interview Questions

Define stl.

0 Answers  


Write a program in C++ returning starting locations of a substring using pointers

1 Answers  


What are the symptoms of stl?

0 Answers  


Give two integer arrays A & B.A has n elements and B has ' n-1 ' elements . A has all the elements that are there in B. But B has one missing element. Write a function that takes arrays , A & B as imnput and finds the missing element in most optised manner .

4 Answers   Zycus Infotech,


Diffrernce Between Overloading and Overriding?

2 Answers   Wipro,






Is stl part of c++ standard?

0 Answers  


how can u do connectivity in c++ language? plz send me connectivity code in c++ ?

0 Answers   Ascent,


how to get the sum of two integers?

2 Answers  


method overloading means what?

2 Answers   CTS,


Write a C/C++ program to add a user to MySQL. The user should be permitted to only "INSERT" into the given database.

0 Answers  


what is compiler?

4 Answers   NASA,


Which data structure gives efficient search? A. B-tree B. binary tree C. array D. linked list

21 Answers   ABC, Sun Microsystems,


Categories