+ 2
usage of F
Why this code doesnot run without F after 5.55? https://code.sololearn.com/cFrki4Aob1qS/?ref=app
2 ответов
+ 7
Just because the compiler considers it to be of the 'double' data-type, thus there's a loss of data while implicit casting of a higher data-type (double) to a lower data-type (float). Using the character f or F tells the compiler that it is a floating point literal.
Alternatively, you can do:
float a = (float) 5.55;
+ 3
De͏͏v Thank you very much