0
public class Main {

public static void main(String[] args) {
    float sum = 0.0f;
    int i;
    float[] sumarray = {1.0f, 2.9f, 64.8f ,23.4f};
    for(i = 0 ; i < sumarray.length ; i++) {
        sum += sumarray[i];
    }
    System.out.println(sum);
}

The output coming is: 92.100006

But if we manually add the elements of the array: it comes out to be 92.1

How is this possible... Please explain in detail I have just started learning java

0 Answers0