Professional Documents
Culture Documents
After Lab-1 - (Ans-2)
After Lab-1 - (Ans-2)
Let us take an example. Variable ’i’ declared as integer and its value is
4.999999 as floating point value. As shown in the figure we can see that the
output is 4. Integer is a whole number. Nothing after the decimal point is
stored.
So if you put a floating value into integer- then everything after the
decimal point is lost. When you convert an integer into float, the missing
decimal part is filled with zeros before being stored into the float variable.
For example if we store integer 4 into float variable then the output is
4.000000.