i think this is very easy...isnt there a function that if i have a numbers like 4,3 4,5 4,6 4,9 it will always round it to 4? or 1,5 1,7 1,2 1,1 it will always round to 1?
Printable View
i think this is very easy...isnt there a function that if i have a numbers like 4,3 4,5 4,6 4,9 it will always round it to 4? or 1,5 1,7 1,2 1,1 it will always round to 1?
Code:Math.Round(3.44, 1); //Returns 3.4.
Math.Round(3.45, 1); //Returns 3.4.
Math.Round(3.46, 1); //Returns 3.5.
cast the value to int
it will round it to the lowest Integer number
so if you do
double num = 1.1 //or 1.9
and you do
int newNum = (int)num;
it will make it 1
ah tks