Hi Poewood,
Since both numerator and denominator are type int the expression 5/14
results in type int. The value is less than 1 and gets truncated, leaving
0. If you want the expression to evaluate to a double, do this:
double result = (double)numerator / (double)denominator;
Joe
--
Joe Mayo, Author/Instructor
Need C#/.NET training?
visit
www.mayosoftware.com
C# Tutorial -
www.csharp-station.com
"Poewood" <Po*****@discussions.microsoft.com> wrote in message
news:BB**********************************@microsof t.com...
I declared 2 integers 'numerator' and 'denominator' and a double 'result'.
If Numerator = 5 and deniminator = 145 then why when I put result in a
string do I get 0?
Example for a label text property:
myLabel.Text= numerator + " / " + denominator + " = " + result;
I get this: 5 / 145 = 0
Where's the decimal? This is a no brainer but I guess I'm lacking in that
department.
Thanx,
Poe