What will be the output of the following C# code?
int n = 2;
int p = 4;
int q = 5;
int w = 3;
if ( !((p * q) /n <= (q * w) + n/p ))
{
Console.WriteLine( ++p + w++ + " " + ++n);
Console.WriteLine("b");
}
else
{
Console.WriteLine(--p + q-- + " " + --n);
Console.WriteLine("a");
}
int n = 2;
int p = 4;
int q = 5;
int w = 3;
if ( !((p * q) /n <= (q * w) + n/p ))
{
Console.WriteLine( ++p + w++ + " " + ++n);
Console.WriteLine("b");
}
else
{
Console.WriteLine(--p + q-- + " " + --n);
Console.WriteLine("a");
}
A. 6 2
b
B. 8 1
a
C. 6 1
a
D. 8 1
b
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