byte b1 = 0xF7; byte b2 = 0xAB; byte temp; temp = (byte)(b1 & b2); Console.Write (temp + " "); temp = (byte)(b1^b2); Console.WriteLine(temp);
if ((n&16) == 16)
Console.WriteLine("Fourth bit is ON");
if ((n&8) == 8)
Console.WriteLine("Fourth bit is ON");
if ((n ! 8) == 8)
Console.WriteLine("Fourth bit is ON");
if ((n ^ 8) == 8)
Console.WriteLine("Fourth bit is ON");
if ((n ~ 8) == 8)
Console. WriteLine("Fourth bit is ON");
if ((n&8) == 8)
Console.WriteLine("Fourth bit is ON");
byte myByte = 153; // In Binary = 10011001 byte n = 8; // In Binary = 00001000 (Here 1 is the 4th bit from right) Now perform logical AND operation (n & myByte) 10011001 00001000 --------- 00001000 Here result is other than 0, so evaluated to True. ---------If the result is true, then we can understand that 4th bit is ON of the given data myByte.
int a = 10; int b = 20; bool c; c = !(a > b);
byte b1 = 0xAB; byte b2 = 0x99; byte temp; temp = (byte)~b2; Console.Write(temp + " "); temp = (byte)(b1 << b2); Console.Write (temp + " "); temp = (byte) (b2 >> 2); Console.WriteLine(temp);
int d; d = Convert.ToInt32( !(30 < 20) );
namespace CuriousTabConsoleApplication { class Sample { public int index; public int[] arr = new int[10]; public void fun(int i, int val) { arr[i] = val; } } class MyProgram { static void Main(string[] args) { Sample s = new Sample(); s.index = 20; Sample.fun(1, 5); s.fun(1, 5); } } }
Comments
There are no comments.Copyright ©CuriousTab. All rights reserved.