#include <bits/stdc++.h>
using namespace std;
int main(){
int n, pos;
while(scanf("%d %d", &n, &pos)){
int bit_on = n|(1<<pos);
int bit_off = n&(~(1<<pos));
int bit_check = n&(1<<pos);
printf("Bit On: %d\nBit off: %d\nBit Check: %d\n", bit_on, bit_off, bit_check);
}
return 0;
}
using namespace std;
int main(){
int n, pos;
while(scanf("%d %d", &n, &pos)){
int bit_on = n|(1<<pos);
int bit_off = n&(~(1<<pos));
int bit_check = n&(1<<pos);
printf("Bit On: %d\nBit off: %d\nBit Check: %d\n", bit_on, bit_off, bit_check);
}
return 0;
}
No comments:
Post a Comment