Answer:
The value of average is 11
Explanation:
Analyzing the program line by line
This line initializes sum to 0
var sum = 0;
This line defines an array named prices and it also fills it with integer values.
var prices = [14, 10, 9, 12, 11, 14, 10, 8];
The italicized lines is an iteration that adds every element of prices and saves the result in variable sum
<em>for( var i = 0; i < prices.length; i++ ) { </em>
<em>sum = sum + prices[i]; </em>
<em>}</em>
At this point, the value of sum is 88
The next line divides the value of sum (88) by the length of the array (8) which gives 11.
11 is then saved in variable average
var average = sum/prices.length;
Answer:
See explaination
Explanation:
public class YearToAnimal {
static void yearToAnimalZodiac(int year){
String[] animals = {"Rat", "Ox", "Tiger", "Rabbit", "Dragon", "Snake", "Horse", "Goat", "Monkey", "Rooster", "Dog", "Pig"};
int baseYear = 2020;
int index = (year - baseYear) % 12;
// in case of negative index, change it to positive
if(index < 0)
index = 12 + index;
System.out.println(year + ": " + animals[index]);
}
// some test cases
public static void main(String[] args) {
yearToAnimalZodiac(2020);
yearToAnimalZodiac(2021);
yearToAnimalZodiac(2019);
yearToAnimalZodiac(2009);
yearToAnimalZodiac(2008);
yearToAnimalZodiac(2007);
}
}
By press over the location that you want using mouse
<span>If you sort a portion of an Excel sheet and you get an error message such as #DIV/0, the cause of the error message is (B) one or more cells containing absolute cell references. The possible reason of this error message includes: (1) e</span><span>ntering division formula that divided by zero (0), (2) and that is being used as a reference.</span>
Need a better discription of the question to finalize an answer.