Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ModifyBit
- {
- class ModifyBit
- {
- static void Main()
- {
- long n = long.Parse(Console.ReadLine());
- int p = int.Parse(Console.ReadLine());
- byte b = byte.Parse(Console.ReadLine());
- long mask = 1 << p;
- if (b == 0)
- {
- Console.WriteLine(mask ^ n);
- }
- else
- {
- Console.WriteLine(mask | n);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement