subject

What does the following loop do?

int[] a = {6, 1, 9, 5, 12, 3};
int len = a. length;
int x = 0;
for (int i = 0; i < len; i++)
if (a[i] % 2 == 0) x++;
system. out. println(x);

1. sums the even elements in a.
2. finds the largest value in a.
3. counts the even elements in a.
4. finds the smallest value in a

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 24.06.2019 05:50
What all vehicles has tesla inc. created over the years
Answers: 3
question
Computers and Technology, 24.06.2019 13:30
Write a program that uses a two-dimensional array to store the highest and lowest temperatures for each month of the year. the program should output the average high, average low, and the highest and lowest temper- atures for the year. your program must consist of the following functions: a. function getdata: this function reads and stores data in the two- dimensional array. b. function averagehigh: this function calculates and returns the average high temperature for the year. c. function averagelow: this function calculates and returns the aver- age low temperature for the year. d. function indexhightemp: this function returns the index of the highest high temperature in the array. e. function indexlowtemp: this function retur
Answers: 3
question
Computers and Technology, 24.06.2019 23:30
What is the opening page of a website called? a. web page b. landing page c. homepage d. opening page
Answers: 1
question
Computers and Technology, 25.06.2019 01:20
Jason typically uses the internet to buy various items. it the total cost of all of the items ordered, at one time, is $250 or more, then the shipping and handling is free, otherwise the shipping and handling is $15 per item. design an algorithm that prompts jason to enter the number of items ordered and the price of each item. (remember cost = number of items order times price) the algorithm then outputs the total billing amount including shipping and handling. your algorithm must use a loop (repetition structure) to get the number and price of each item. write this in algorithm format not program code format.
Answers: 2
You know the right answer?
What does the following loop do?

int[] a = {6, 1, 9, 5, 12, 3};
int len = a. l...
Questions
question
Arts, 23.04.2021 02:00
question
Mathematics, 23.04.2021 02:00
question
Chemistry, 23.04.2021 02:00
question
Mathematics, 23.04.2021 02:00