What will be the output of the following C# code?
static void Main(string[] args)
{
int y = 5;
int x;
int k = (!(Convert.ToInt32(y) > 10))? x = y + 3 : x = y + 10;
Console.WriteLine(x);
Console.WriteLine(y);
Console.ReadLine();
}
static void Main(string[] args)
{
int y = 5;
int x;
int k = (!(Convert.ToInt32(y) > 10))? x = y + 3 : x = y + 10;
Console.WriteLine(x);
Console.WriteLine(y);
Console.ReadLine();
}
A. 5, 8
B. 10, 4
C. 8, 5
D. 11, 8
Answer: Option C
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