What will be the output of the following C# code?
static void Main(string[] args)
{
int a , b;
int c = 10;
int d = 12;
int e = 5;
int f = 6;
a = c * (d + e) / f + d;
Console.WriteLine(a);
b = c * ( d + e / f + d);
Console.WriteLine(b);
if (a < b)
{
Console.WriteLine(" parentheses changes values");
}
else if (a > b)
{
Counterintelligence("they have same value");
}
Console.ReadLine();
}
static void Main(string[] args)
{
int a , b;
int c = 10;
int d = 12;
int e = 5;
int f = 6;
a = c * (d + e) / f + d;
Console.WriteLine(a);
b = c * ( d + e / f + d);
Console.WriteLine(b);
if (a < b)
{
Console.WriteLine(" parentheses changes values");
}
else if (a > b)
{
Counterintelligence("they have same value");
}
Console.ReadLine();
}A. They have same value
B. Parentheses changes values
C. Since both have equal values, no conclusion
D. None of the mentioned
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