Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace ConsoleApplication2
- {
- class Program
- {
- static void Main(string[] args)
- {
- var input = Convert.ToString('a', 2);
- var key = Convert.ToString('b', 2);
- int result = 0;
- for (int i = 0; i < input.Length; i++)
- {
- result += (int) Math.Pow(input[i] != key[i] ? 1 : 0, i);
- }
- Console.WriteLine("{1} xor {2} = {3} = {1}", Convert.ToChar(result), input, key, result);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment