What will be the output of the following C# code?

static void Main(string[] args)
{
    int x = 1;
    float y = 2. 4f;
    short z = 1;
    Console. WriteLine((float) x + y * z - (x + = (short) y) );
    Console. ReadLine();
}

a) 0.4000004
b) 0.4000023
c) 0.0400021
d) 0.4000001

1 thought on “What will be the output of the following C# code?”

Leave a Comment