From 9689f5ab94230dd8d75f5163778a4fdcf24fa7fd Mon Sep 17 00:00:00 2001 From: Udhay <72250606+Udhay-Brahmi@users.noreply.github.com> Date: Wed, 23 Dec 2020 08:01:43 +0530 Subject: [PATCH] Create Equal Sum and XOR --- Equal Sum and XOR | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Equal Sum and XOR diff --git a/Equal Sum and XOR b/Equal Sum and XOR new file mode 100644 index 0000000..9006b01 --- /dev/null +++ b/Equal Sum and XOR @@ -0,0 +1,30 @@ +// { Driver Code Starts +#include + + +int countValues (int n); +int main() +{ + int t; + scanf("%d",&t); + while(t--) + { + int n; + scanf("%d",&n); + + printf("%d\n",countValues(n)); + } +}// } Driver Code Ends + + +/*You are required to complete this method */ +int countValues (int n) +{ + //Your code here + int k=0; + for(int i=0;i<=n;i++){ + if((n+i)==(n^i)){k++;} + } + return k; +} +