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
When should you not use a type cast?
What do you mean by scope of a variable in c?
what value is returned to operating system after program execution?
How can I display a percentage-done indication that updates itself in place, or show one of those twirling baton progress indicators?
How the c program is executed?
What are linked lists in c?
Explain bit masking in c?
What is the difference between exit() and _exit() function?
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.
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
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?
What's the difference between constant char *p and char * constant p?
What is scope rule in c?
Explain what are global variables and explain how do you declare them?
Which driver is a pure java driver