Computers and Technology

Given the following code, what logic would you need to include to determine how many times the number 2 appears within the array: int[] myArray = {1,2,3,2,5,6,2,8,2,10};

for (int i = 0; i < myArray. length; i++) {
//your code goes here
}
Sample Output: The number 2 appears 4 times in this array.
NOTE: Your response should be just the missing logic--not the entire problem set.

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 21:00, hannaboo53
In this lab, you add a loop and the statements that make up the loop body to a c++ program that is provided. when completed, the program should calculate two totals: the number of left-handed people and the number of right-handed people in your class. your loop should execute until the user enters the character x instead of l for left-handed or r for right-handed. the inputs for this program are as follows: r, r, r, l, l, l, r, l, r, r, l, x variables have been declared for you, and the input and output statements have been written.
Answers: 3
image
Computers and Technology, 22.06.2019 06:30, westjayson69
Requirement types discussed during software development include functional and color scheme nonfunctional and code style constraint and nonfunctional fashionable and functional.
Answers: 2
image
Computers and Technology, 22.06.2019 16:20, kimmmmmmy333
Octothorpe is another name for what common computer keyboard symbol?
Answers: 1
image
Computers and Technology, 22.06.2019 23:30, ansonhunter8891
What are listed in the vertical columns across the top of the event editor? a. file names b. conditions c. check marks d. action types
Answers: 1
Do you know the correct answer?
Given the following code, what logic would you need to include to determine how many times the numbe...

Questions in other subjects: