N = 7
7 = 0
1 1 1
=
0 1 1 0 ( = 6)
N = 6
6 = 0
1 1 0
=
0 1 0 0 ( = 4)
Code :
cin>>n; x = n&(n-1); cout<<x<<endl; |
N = 7
7 = 0
1 1 1
=
0 1 1 0 ( = 6)
N = 6
6 = 0
1 1 0
=
0 1 0 0 ( = 4)
Code :
cin>>n; x = n&(n-1); cout<<x<<endl; |
Comments
Post a Comment