Advertisement
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;
- using System.Threading.Tasks;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- int b = 0, a = 0;
- while (b != -1)
- {
- Console.WriteLine("a: ");
- a = int.Parse(Console.ReadLine());
- Console.WriteLine("b: ");
- b = int.Parse(Console.ReadLine());
- string abinary = Convert.ToString(a, 2);
- string bbinary = Convert.ToString(b, 2);
- Console.WriteLine(string.Format("a: {0}", abinary));
- Console.WriteLine(string.Format("b: {0}", bbinary));
- int XOR = (a ^ b);
- Console.WriteLine("XOR: (int) {0}", XOR);
- Console.WriteLine("XOR (binary) {0}", Convert.ToString(XOR, 2));
- }
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement