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
The basic input/output system (bios locates the boot loader program on a linux system by reading the __________ on the hard driv
Diano4ka-milaya [45]
If the disk was formatted with fdisk, the MBR (Master Boot Record).
6 0
3 years ago
1. cybersquatting refers to the tampering of existing web sites and selling unrelated products (true or false)
Dmitrij [34]

Answer:

i think its 17

Explanation:

i rerwerwerwrwerewr

5 0
3 years ago
Uses computers resources from multiple locations to solve ​
kodGreya [7K]

Answer:

computers are solve all things in are life

3 0
3 years ago
Read 2 more answers
Why can’t I message people? It doesn’t let me, please help.
Rudiy27

Answer:

they let that texting stuff go a year ago so now its just sitting there

Explanation:

6 0
3 years ago
Read 2 more answers
The following is a true example of a computer: A. Toyota Camry
fomenos

Answer:

D

Explanation:

They all fit the definition of a computer

7 0
3 years ago
Other questions:
  • Different between ocular and compound miscroscope
    13·1 answer
  • What does intergrated organization mean
    15·1 answer
  • To remove text from a specific location and keep it to use again, you should select ___
    6·1 answer
  • Design and implement an application that plays the Hi-Lo guessing game with numbers. The program should pick a random number bet
    13·1 answer
  • You have just purchased a motherboard that has an LGA 1156 socket for an Intel Pentium processor. What type of memory modules wi
    14·1 answer
  • Video is a medium that's looks real anyways, but is real________________.
    10·1 answer
  • HELP PLZZZZZZZZ!!!!!!!!!!!
    14·1 answer
  • 10(            )  8(532.2 )                         
    15·1 answer
  • Mention and explain various alignment options​
    9·1 answer
  • Chantal has configured the network at her company's new headquarters with a number of VLANs. All devices joined to the individua
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!