Answered step by step
Verified Expert Solution
Link Copied!

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

MySQL/PHP Database Applications

Authors: Jay Greenspan, Brad Bulger

1st Edition

978-0764535376

More Books

Students also viewed these Databases questions