Does anyone know why integer division in C# returns an integer and not a float? What is the idea behind it? (Is it only a legacy of C/C++?)
In C#:
fl
Might be useful:
double a = 5.0/2.0; Console.WriteLine (a); // 2.5 double b = 5/2; Console.WriteLine (b); // 2 int c = 5/2; Console.WriteLine (c); // 2 double d = 5f/2f; Console.WriteLine (d); // 2.5