Sail E0 Webinar
Question


What is the output of this program?


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);
}
}
Options:
A .  16.34
B .  16.566666644
C .  16.46666666666667
D .  16.46666666666666
Answer: Option C

None.
output:
$ javac average.java
$ java average
16.46666666666667



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers