if array a conatins 'n' elements and array b conatins 'n-1'
elements.array b has all element which are present in array
a but one element is missing in array b. find that
element.

Answer Posted / venu

use XOR association operation.
I mean: a = b^a^b = a^b^b = a;[bec a^a =0 always]

int main()
{
int a[3] = {3,4,5};
int b[4] = {7,4,5,3};
int r,i;
int n=4;

r1 = b[3];

for(i=0;i<n-1;i++)
{
r1 = r1^a[i]^b[i];
}

printf("number = %d \n",r);
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

When should you not use a type cast?

661


What do you mean by scope of a variable in c?

546


what value is returned to operating system after program execution?

1608


How can I display a percentage-done indication that updates itself in place, or show one of those twirling baton progress indicators?

586


How the c program is executed?

635






What are linked lists in c?

651


Explain bit masking in c?

642


What is the difference between exit() and _exit() function?

610


4-Take two sets of 5 numbers from user in two arrays. Sort array 1 in ascending and array 2 in descending order. Perform sorting by passing array to a function mySort(array, sortingOrder). Then multiply both the arrays returned from function, using metric multiplication technique in main. Print result in metric format.

1731


An organised method of depicting the use of an area of computer memory used to signify the uses for different parts of the memory a) swap b) extended memory c) memory map d) all of the above

710


hai iam working in sap sd module for one year and working in lumax ind ltd in desp department but my problem is i have done m.b.a in hr/marketing and working sap sd there is any combination it. can you give right solution of my problem. and what can i do?

1667


What's the difference between constant char *p and char * constant p?

660


What is scope rule in c?

609


Explain what are global variables and explain how do you declare them?

645


Which driver is a pure java driver

996