C# Programming - Operators - Discussion

Discussion Forum : Operators - General Questions (Q.No. 2)
2.
What will be the output of the C#.NET code snippet given below?
byte b1 = 0xF7;
byte b2 = 0xAB;
byte temp;
temp = (byte)(b1 & b2);
Console.Write (temp + " ");
temp = (byte)(b1^b2);
Console.WriteLine(temp);
163 92
92 163
192 63
0 1
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
33 comments Page 4 of 4.

Sai said:   9 years ago
How to identify f = 15.... a = 10?

Siva said:   9 years ago
For simple calculations use these code for fast conversion for decimal to binary and binary to desired values "8421".

Hexadecimal values 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A = 10, B = 11, C = 12, D = 13, E = 14, F = 15.
A =10
So, we take 8 4 2 1
=> 1 0 1 0 = 8 + 2 = 10.

F = 15
So, we take 8 4 2 1
=> 1 1 1 1= 8 + 4 + 2 + 1 = 15.

Kumar said:   6 years ago
OR operator

how it is possible ?
11110111
10101011
_________
01011100 = 92

OR operator
1 1 T
1 0 T
0 1 T
0 0 F


Post your comments here:

Your comments will be displayed after verification.