A

Admin • 828.03K Points
Coach

Q. 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) 0 1 2 3 4
  • (C) 16.46666666666667
  • (D) 16.46666666666666
  • Correct Answer - Option(C)
  • Views: 18
  • Filed under category Java
  • Hashtags:

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.