0
public class Program { public static void main(String[] args) { float a =10.2; float b=5.3; float c=a%b;
Why It is generating lossy conversation error https://code.sololearn.com/cNycLz9L5K8Z/?ref=app
4 Respuestas
+ 1
You just need to add f.
Like this float a = 0.1f
+ 2
double is more precise than float.
You have the following options:
1. Calculate with floats, less precise - therefore you have to use float values, e.g.: float a = 10.2f
2. You use double values for each var.
+ 1
You have to add f in the end of the number if you want to assign a double value to float
+ 1
Thank you all