How do you divide integers and get a double in C#?

c#, math

Solution

Because the division is done with integers then converted to a double. Try this instead:

double pct = (double)x / (double)y;

Problem

``` int x = 73; int y = 100; double pct = x/y; ``` Why do I see 0 instead of .73?

Original source

Related problems