S
shapper
Hello,
I have the following:
int a; int b; var c
c = a / (float)b;
I used float to not get an int value as result. I think in C# I must.
But know I want to round c to something like 3.48 or 7.50, ...
I am using Math.Round(c,2) but I get the error:
Cannot implicitly convert type 'double' to 'float'. An explicit
conversion exists (are you missing a cast?)
I also tried Math.Round((double)c,2)
What am I doing wrong?
Thanks,
Miguel
I have the following:
int a; int b; var c
c = a / (float)b;
I used float to not get an int value as result. I think in C# I must.
But know I want to round c to something like 3.48 or 7.50, ...
I am using Math.Round(c,2) but I get the error:
Cannot implicitly convert type 'double' to 'float'. An explicit
conversion exists (are you missing a cast?)
I also tried Math.Round((double)c,2)
What am I doing wrong?
Thanks,
Miguel