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

what is compiler?

4 Answers   NASA,


In what scenario does the Logical file and Physical file being used?

1 Answers   informatics,


What is stl stack?

1 Answers  


Explain References in C++

3 Answers  


HOW TO GET "H1B" -VISA 4 USA FOR MY SON?HE HAD COMPLETED "MS"(IT)FROM AUSTALIA 2007.I AM WORKING IN U.S.A.

0 Answers  


I am doing my BS.c MATHS CAN I ABLE TO JOIN IN NIIT?

2 Answers  


write a program that input four digit no and finds it is palindrome or not

2 Answers  


how to get the sum of two integers?

2 Answers  


Write a program in C++ to concatenate two strings into third string using pointers

5 Answers  


Describe the elements of Microsoft Word screen. Write down steps for creating, saving, retrieving, editing and printing a document.

2 Answers  


what is template and type convertion

1 Answers   TATA,


Give the output of the following program main() {int ret; ret=fork();ret=fork();ret=fork();ret=fork(); if(!ret) printf("sun"); else printf("solaris");

8 Answers   Sun Microsystems,


Categories