In web application, i write the code like this :
float f= 659/1024
but i am getting the resule in f is 0.0 where it has to be 0.6458 smething
You are dividing two integers, so the result will be 0. You have to cast the numbers to float:
float f = (float)659/(float)1024
You are seeing this because you are performing integer division and then assigning the result to a float. Try the following instead:
float f = 659.0 / 1024;
Or to be more explicit:
float f = (float)659 / 1024;
Note that only one of the numbers needs to be a float to make the operation perform floating point arithmetic instead of integer arithmetic.