Advertisements
Advertisements
Question
Give reason whether the following assignment is correct or not.
float f = 0.002654132;
Answer in Brief
Solution
This assignment is incorrect since the data type for 0.002654132 is double, yet it is assigned to a float variable. The correct assignment will be float f = 0.002654132f;
shaalaa.com
Is there an error in this question or solution?
Chapter 1.03: Values and Data Types - EXERCISES [Page 33]