+ 2

Could you tell me why this declaration give an error on Sololearn: float a= 42.8;

8th Jul 2020, 11:21 AM
Theo Martier
Theo Martier - avatar
6 odpowiedzi
+ 6
float a = 43.8f; Try this
8th Jul 2020, 11:25 AM
Nilesh
Nilesh - avatar
+ 5
https://code.sololearn.com/cUgMY1ewzZFZ/?ref=app you have forgotten to use f after the value declaration
8th Jul 2020, 11:27 AM
Nilesh
Nilesh - avatar
+ 2
Theo Martier , change it to float a = 42.8f;
8th Jul 2020, 11:25 AM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 1
Thank you everybody I think it can be a problem to use flaot type with this "f" for precision during a calculation😕
8th Jul 2020, 11:33 AM
Theo Martier
Theo Martier - avatar
0
Thank you but isn't it a flaot too (with bo too much figure after the comma)
8th Jul 2020, 11:27 AM
Theo Martier
Theo Martier - avatar
0
...not too much..
8th Jul 2020, 11:27 AM
Theo Martier
Theo Martier - avatar