What will be the output of the following C# code?
public static void Main()
{
byte varA = 10;
byte varB = 20;
long result = varA | varB;
Console.WriteLine("{0} OR {1} Result :{2}", varA, varB, result);
varA = 10;
varB = 10;
result = varA | varB;
Console.WriteLine("{0} OR {1} Result : {2}", varA, varB, result);
}
public static void Main()
{
byte varA = 10;
byte varB = 20;
long result = varA | varB;
Console.WriteLine("{0} OR {1} Result :{2}", varA, varB, result);
varA = 10;
varB = 10;
result = varA | varB;
Console.WriteLine("{0} OR {1} Result : {2}", varA, varB, result);
}
A. 20, 10
B. 30, 10
C. 10, 20
D. 10, 10
Answer: Option B
Related Questions on Operators and Expressions in C Sharp
What does the modulus operator (%) do in C#?
A. Increments the operand by 1
B. Returns the quotient of a division
C. Performs multiplication
D. Returns the remainder of a division
Join The Discussion