I know many if us are laughing seeing this question , but if i have taken some floating point value and I want if the result is integer it should have some decimal point answer
eg - 1 can be integer number
I want 1.0 to appear in my result.
How to do that , I knows its a very basic question
Do you only want a number to appear like a floating point number, say, for console or file output? Or do you want to use an int like a float in computations?
If you only want it to look like a float, you can do it through formatting, like "ddanbe" suggested, or the option you used.
If you want to use the number in computations, you could use a typecast to make sure it is treated like a float. For example, the following code snippet takes an integer variable, iVar1, uses it in a computation as a double, and assigns the result to a variable, CircCircum of type double:
// Compute circumference of Circle, given integer radius iVar1
. . .
CirCircum = 2.0 * 3.14159 * (double) iVar1;
. . .
Type casting the integer variable makes sure it is used properly in this calculation (i.e. - as a type double.)