Advertisement
tnngo2

BitwiseLogicalOperators

Apr 4th, 2012
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.19 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace Theory2
  7. {
  8.     class BitwiseLogicalOperators
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             int _and = 56 & 28;
  13.             int _or = 56 | 28;
  14.             int _eor = 56 ^ 28;
  15.             Console.WriteLine("56  => " + Convert.ToString(56,2).PadLeft(8,'0'));
  16.             Console.WriteLine("28  => " + Convert.ToString(28, 2).PadLeft(8, '0'));
  17.             Console.WriteLine("and => " + Convert.ToString(_and, 2).PadLeft(8, '0'));
  18.             Console.WriteLine("==========================");
  19.             Console.WriteLine("56  => " + Convert.ToString(56, 2).PadLeft(8, '0'));
  20.             Console.WriteLine("28  => " + Convert.ToString(28, 2).PadLeft(8, '0'));
  21.             Console.WriteLine("or  => " + Convert.ToString(_or, 2).PadLeft(8, '0'));
  22.  
  23.             Console.WriteLine("==========================");
  24.             Console.WriteLine("56  => " + Convert.ToString(56, 2).PadLeft(8, '0'));
  25.             Console.WriteLine("28  => " + Convert.ToString(28, 2).PadLeft(8, '0'));
  26.             Console.WriteLine("eor => " + Convert.ToString(_eor, 2).PadLeft(8, '0'));
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement