C# decimal places with integer operators
Posted
by user294982
on Stack Overflow
See other posts from Stack Overflow
or by user294982
Published on 2010-05-20T14:26:53Z
Indexed on
2010/05/20
14:30 UTC
Read the original article
Hit count: 253
So I have this code:
p.Value = 1;
decimal avg = p.Value * 100 / 10000;
string prntout = p.Key + " : " + avg.ToString();
Console.WriteLine(prntout);
But the program prints out 0, instead of 0.01. p.Value is an int. How do I fix that?
© Stack Overflow or respective owner