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

static void Main(string[] args)
{
    float a = 10.553f;
    long b = 12L;
    int  c;
    c = Convert.ToInt32(a + b);
    Console.WriteLine(c);
}

a) 23.453
b) 22
c) 23
d) 22.453

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

  1. c
    Explanation: The two data type ‘float’ and ‘long’ after arithmetic operation completely converted to nearest whole number 23.
    Output : 23

Leave a Comment