K Kevin Spencer Oct 21, 2004 #2 Because the integer 500 divided by the integer 2000 returns the integer 0. Default math rules. To get a non-zero value: decimal pct2 = ((decimal) 500 / (decimal) 2000) * (decimal) 100; - or - decimal pct2 = (500d / 2000d) * 100d; -- HTH, Kevin Spencer ..Net Developer Microsoft MVP I get paid good money to solve puzzles for a living
Because the integer 500 divided by the integer 2000 returns the integer 0. Default math rules. To get a non-zero value: decimal pct2 = ((decimal) 500 / (decimal) 2000) * (decimal) 100; - or - decimal pct2 = (500d / 2000d) * 100d; -- HTH, Kevin Spencer ..Net Developer Microsoft MVP I get paid good money to solve puzzles for a living