Question: Given the following code in C#, what is the final value of X written to the console? Show how you arrived at the result (intermediate
- Given the following code in C#, what is the final value of X written to the console? Show how you arrived at the result (intermediate values of X within the program) as well.
int N = 0, M = 0, I = 0, X;
X = Convert.ToInt32(100.9 + (31.6 / Math.Pow(2, 3)) * Math.Ceiling(-3.2));
if ((X > 36) || (X > M + N) && (X == 12))
{
do
{
X -= I;
I += 30;
} while (I <= X);
}
else
{
if ((X == 45) || ((X >= 20) && (X <= 80)))
X += 1;
else if ((X >= 30) && (X <= 90))
Convert.ToInt32(X /= 2);
else
X = 0;
}
Console.WriteLine(X);
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
