#include <iostream> using namespace std; int main() { // your code goes here int n,result=0; n = 50; for(int i=0;i<=n;i++){ result =result^i; cout<<i<<" ---"<<result<<endl; } return 0; }
Standard input is empty
0 ---0 1 ---1 2 ---3 3 ---0 4 ---4 5 ---1 6 ---7 7 ---0 8 ---8 9 ---1 10 ---11 11 ---0 12 ---12 13 ---1 14 ---15 15 ---0 16 ---16 17 ---1 18 ---19 19 ---0 20 ---20 21 ---1 22 ---23 23 ---0 24 ---24 25 ---1 26 ---27 27 ---0 28 ---28 29 ---1 30 ---31 31 ---0 32 ---32 33 ---1 34 ---35 35 ---0 36 ---36 37 ---1 38 ---39 39 ---0 40 ---40 41 ---1 42 ---43 43 ---0 44 ---44 45 ---1 46 ---47 47 ---0 48 ---48 49 ---1 50 ---51