What is the code I need to cast sum / numbers.length from int to double here? Fi
ID: 3816796 • Letter: W
Question
What is the code I need to cast sum / numbers.length from int to double here?
First, find the sum of all values in the numbers array. Return the sum divided by the number of elements in the array. Remember that sum and numbers. length is both type int so you need to do a cast before you divide. For this activity, you can assume that number. length is not equal to zero. return/; Compile Scores and run the following code in the interactions pane. Be sure to drag avg from the workbench onto the canvasExplanation / Answer
Answer: return sum / (double)numbers.length;
you need to do a type case like above.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.