what are the valid values of float and double? I understood that integer can have numbers from 0 to 65536. but didn't understand the limitations of the float and double.
Minimum value for a float is 1.175494351 E – 38 (if you're not familiar with "E" it means "*10^"). Max float is 3.402823466 E + 38.
Min double is 2.2250738585072014 E – 308 and max double is 1.7976931348623158 E + 308.
If you're not understanding these limitations, keep in mind that the computer is storing them in binary. The number and all the decimal places take up a certain amount of memory in binary. These determine how precise the number is. Then the exponent (after the "E") takes up more memory. The allowable size of the exponent determines the allowable range of the type. Whether the exponent is positive or negative, it still takes up the same amount of memory. That's why you can't store anything between 0 and 2.2250738585072014 E – 308.
RAM is pretty cheap nowadays, so you should usually use double unless you really have a good reason to use float.
The values can vary depending on your system (hardware+compiler), so it's best to find out for yourself. Here's a quick example which displays some of the limits:
Notice this gives the limits for signed integers. Because half the range is occupied by negative numbers, the largest value is about half that of unsigned integers. Example output, but please don't take my word for it, your machine may differ: