Dividing into fractors in C#
Posted
by Shane
on Stack Overflow
See other posts from Stack Overflow
or by Shane
Published on 2010-06-13T14:52:22Z
Indexed on
2010/06/13
15:02 UTC
Read the original article
Hit count: 222
c#
Simple question I think, I am a little unsure as to why
decimal currentPercentage = 0;
currentPercentage = currentPercentage*((decimal)1 / (decimal)daysPerYear--);//or
currentPercentage *= ((decimal)1 / (decimal)daysPerYear--);
Will return 0 everytime but
(decimal)1 / (decimal)daysPerYear--;
will return the decimal I am after. What am I missing here?
© Stack Overflow or respective owner