no rounds
-
i hv problems below: a = 123456.789 b = 7 c = a/b --> the result is 17636.6841 but i want it shows 17636 (not rounding to 17637) can anyone helps??? thx, cool-a
-
i hv problems below: a = 123456.789 b = 7 c = a/b --> the result is 17636.6841 but i want it shows 17636 (not rounding to 17637) can anyone helps??? thx, cool-a
-
i hv problems below: a = 123456.789 b = 7 c = a/b --> the result is 17636.6841 but i want it shows 17636 (not rounding to 17637) can anyone helps??? thx, cool-a
There are a lot of solutions to your problem, but you didn't tell us whether or not you're displaying the number, or merely want to omit the fractional part from further calculations. Assuming you just want to display, it, do it this way:
string cString = Convert.ToInt32(c).ToString();
If you want to change the actual value, you can use Math.Floor, or even Convert.ToInt32 (I think).
.45 ACP - because shooting twice is just silly
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001 -
i hv problems below: a = 123456.789 b = 7 c = a/b --> the result is 17636.6841 but i want it shows 17636 (not rounding to 17637) can anyone helps??? thx, cool-a
Review the "Math" library. There is a "Floor" and "Ceiling" function. Ceiling rounds 1.1 to 2 and Floor makes 1.9 to 1. You will need to make sure a and b are "double" but will be fine.
double a = 123456.789;
double b = 7;
double c = Math.Floor(a/b); -
i hv problems below: a = 123456.789 b = 7 c = a/b --> the result is 17636.6841 but i want it shows 17636 (not rounding to 17637) can anyone helps??? thx, cool-a
thx all... it helps me lot