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?
You’re multiplying by 0.
currentPercentageis0before computing:So you have in fact:
This expression is
0no matter what((decimal)1 / (decimal)daysPerYear--)is 🙂