Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started