1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
lapo4ka [179]
3 years ago
13

Write a method that take an integer array as a parameter and returns the sum of positive odd numbers and sum of positive even nu

mbers.
Computers and Technology
1 answer:
elixir [45]3 years ago
6 0

Answer:

I will code in Javascript:

function sumOddAndEven(){

<em> //Define and initialize variables.</em>

var numbers = [1,2,3,4,5,6,7,8];

var sum = [0,0];

for ( var i = 0;  i < numbers.length ; i++ ){  <em>// loop to go throght the numbers</em>

<em> </em>if(numbers[i] > 0) {<em> // if the number is positive</em>

  if(numbers[i]%2 == 0) {  <em>// if number is even and </em>

     sum[0] = sum[0] + numbers[i];  <em>//adds in the first place of sum</em>

   }

   else{  

     sum[1] = sum[1] + numbers[i];  <em>// else adds in the second place of sum</em>

   }

 }

}

 return sum; <em>//return an array with the sum of the positive evens numbers  in the first place and the sum of the positive odd numbers in the second place.</em>

}  

You might be interested in
Name at least 3 different portable computer devices that can be purchased
rosijanka [135]

Answer:

Smart Phone

Cameras

Console Controller

Brainliest and please say if its right!!

3 0
2 years ago
Read 2 more answers
Please help I I decided to screen shot something in my laptop but now my screen isn’t working or moving can you give me a way to
ehidna [41]

Answer:

Just restart it. It would definitely work.

6 0
3 years ago
Read 2 more answers
You can enter the following things in cells
katrin [286]

Answer:

You enter three types of data in cells: labels, values, and formulas.

Explanation:

I hope this is the right answer I knew it on top of my head but I made sure with goggle to.

3 0
2 years ago
What are some examples of trademarks?!! Some one please help! Have a great day btw! help me pleaseee
Alchen [17]
A trademark can be anything! it could be be a hair tie, a flag and even a bag.
7 0
2 years ago
"The reason the virus exists is population control. They did this in a lab on purpose!"
Shkiper50 [21]
The correct answer is C
7 0
2 years ago
Other questions:
  • Which Internet resource can you use to publicly describe an adventure trip you recently made?
    9·1 answer
  • During the troubleshooting of a pc that will not boot, it is suspected that the problem is with the ram modules. the ram modules
    14·1 answer
  • Who would use a CLI? (Command Line Interface)
    9·1 answer
  • Give the imporntance of having standard funiture in the laboratory​
    11·1 answer
  • What is the part of a file, the .pptx, or .txt etc called?
    14·2 answers
  • Complete the statement below with the correct term.
    5·1 answer
  • Write a function, named "wait_die_scheduler" that takes a list of actions, and returns a list of actions according to the follow
    11·1 answer
  • you crossed two heterozygous red flowers (dominant color), what are your chances to have a white flower
    11·1 answer
  • 8.2 code practice edhesive?
    8·1 answer
  • ________ is the art of manipulating people into breaking normal security procedures or divulging confidential information.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!