Examveda

What will be the output of the following Java code?
class average {
    public static void main(String args[])
    {
        double num[] = {5.5, 10.1, 11, 12.8, 56.9, 2.5};
        double result;
        result = 0;
        for (int i = 0; i < 6; ++i) 
            result = result + num[i];
  System.out.print(result/6);

    } 
}

A. 16.34

B. 16.566666644

C. 16.46666666666667

D. 16.46666666666666

Answer: Option C


This Question Belongs to Java Program >> Data Types And Variables

Join The Discussion

Related Questions on Data Types and Variables