In this loop, I am not getting the value 3.9. It stop at 3.8
for(double a=0.0;a<=3.9; a+=0.1)
System.out.println((double) Math.round(a * 10) / 10);
Output:
0.0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1.0
1.1
1.2
1.3
1.4
1.5
1.6
1.7
1.8
1.9
2.0
2.1
2.2
2.3
2.4
2.5
2.6
2.7
2.8
2.9
3.0
3.1
3.2
3.3
3.4
3.5
3.6
3.7
3.8