Answer to Question #270144 in C for mona

Question #270144

write a program to find the duplicate number in the array



which is also prime.

1
Expert's answer
2021-11-22T15:17:22-0500
int DuplicateNumber(int arr[], int size){
    int ans=0;
    for(int i=0;i<size;i++){
        ans= ans ^ arr[i] ; 
    }
    for(int i=0;i<=size-2;i++){
        ans= ans ^ i;
    }
    return ans;
   }

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS