Skip to content

Commit

Permalink
Create xor_till_n.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
pratik-2707 committed Oct 4, 2021
1 parent 9a4f1b8 commit 5f4a4e8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions bit_manipulation/xor_till_n.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include <bits/stdc++.h>

using namespace std ;

int main () {
int n = 7, i ,res=1 ;
for(i=2;i<=n;i++) {
res = res^i ;
}
cout<<res<<endl;
}

0 comments on commit 5f4a4e8

Please sign in to comment.