Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

What will be the output of the following C# code?
static void Main(string[] args)
{
float i = 1.0f, j = 0.05f;
do
{
Console.WriteLine(i++ – ++j);
}while (i < 2.0f && j <= 2.0f);
Console.ReadLine();
}

What will be the output of the following C# code?
static void Main(string[] args)
{
float i = 1.0f, j = 0.05f;
do
{
Console.WriteLine(i++ – ++j);
}while (i < 2.0f && j <= 2.0f);
Console.ReadLine();
}
a) 0.05
b) -0.05
c) 0.95
d) -0.04999995

Answer: d
Explanation: Output : -0.04999995

Join The Discussion