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
πŸ’¬ Discuss
βœ… Correct Answer: (C) 16.46666666666667

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
175
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Bhagwan Das
Publisher
πŸ“ˆ
87%
Success Rate