What's wrong with this division? [closed]
I think there's a lot for me to learn about data types. Why this happens double result = ((3/8)*100).ToString(); it gives zero .. should be 37,5 ... :( 3/8 performs an integer division and the result is 0 double result = ((3.0/8)*100); should do it. By the way, if you do ((3.0/8)*100).ToString() you get a String and not a double. double result = ((3.0/8.0)*100); Should do it. You were performing integer division, not floating point division. You need to convince the compiler to perform floating point division: double result = (((double)3/8)*100); Otherwise it performs integer division and 3/8