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
How can I find the modification date and time of a file?
Do pointers need to be initialized?
What is sizeof array?
What is a pointer and how it is initialized?
Why does everyone say not to use gets?
Explain what are compound statements?
Under what circumstances does a name clash occur?
What are the 5 data types?
Are global variables static in c?
Why isnt any of this standardized in c?
Is there anything like an ifdef for typedefs?
Write a function expand(s1,s2) that expands shorthand notations like a-z in the string s1 into the equivalent complete list abc...xyz in s2 . Allow for letters of either case and digits, and be prepared to handle cases like a-b-c and a-z0-9 and -a-z. z-a:zyx......ba -1-6-:-123456- 1-9-1:123456789987654321 a-R-L:a-R...L a-b-c:abbc
Why functions are used in c?
What is restrict keyword in c?
the portion of a computer program within which the definition of the variable remains unchanged a) mode b) module c) scope d) none