Question: Assume we have declared a variable of type int[] called nums , which you can assume to be non-empty. TASK: Compute and print the average

Assume we have declared a variable of type int[] called nums , which you can assume to be non-empty.

TASK: Compute and print the average of the numbers in nums.

NOTE: You do not need to create a class or a main method. Just write the code to compute and print the average.

HINT: Recall, the average is equal to the sum of all of the numbers, divided by the number of numbers.

Sample Input 1:

1 2 3 4 5

Sample Output 1:

3

Sample Input 2:

1 2 3 4 5 6

Sample Output 2:

3.5

PLEASE ANSWER IN JAVA

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!