> OR mask1 with num1, print the result
> toggle num1, print the result
None of your code does either of these things.
You might save some confusion by renaming your 'bit_mask' to something better, like print_in_binary.
> OR mask1 with num1, print the result
> toggle num1, print the result
None of your code does either of these things.
You might save some confusion by renaming your 'bit_mask' to something better, like print_in_binary.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.