Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main() {
- int n = 10;
- int count = 0;
- int res = 0;
- for(int temp=n; temp > 0; temp>>=1) {
- if(count % 2 == 0) {
- res |= (1<<count);
- }
- count++;
- }
- printf("%d", (n | res));
- return 0;
- }
Add Comment
Please, Sign In to add comment