joshualoz3034 joshualoz3034
  • 23-05-2018
  • Computers and Technology
contestada

Write the code to compute and output how many times the value 99 is found in an array of integers named numbers

Respuesta :

kaevras
kaevras kaevras
  • 24-05-2018
Thank you for being the rare question where you actually provide what language you want your answer in; I approve, and encourage this.

In Java, the following will work.
I made it a bit more versatile to work with others numbers, other than 99, if you so please (if not, just hardcode the 99 in yourself).

// Example list - fill this with numbers yourself.
ArrayList<Integer> nums = new ArrayList<>();
int n = 99;
int count = (int)nums.stream().filter(i -> i == n).count();
System.out.println(n + " occurences.");
Answer Link

Otras preguntas

Explain how the types of mountain landforms are related to one another.
what part of speech is abundant
How can you tell 7/10 is greater than 1/2
The area of a triangle is 6.75 m to the 2 power.  If the base of the triangle is 3 m, what is the height of the triangle?
What happened during the holocaust?
What is a protein? Describe the monomers and polymers of protein? What are the functions of proteins? What atoms make up proteins?
The area of a triangle is 6.75 m to the 2 power.  If the base of the triangle is 3 m, what is the height of the triangle?
Millions of Americans are subjected to drug testing in the workplace.  The tests are not always reliable.  A false positive rate of 5% is considered to be a con
Describe how trade contributed to United States territorial growth.
Why did the colonists fought back against the British rule?