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
Tyesha is trying to create a resume using a template on Word, but she can not figure it out. What wrong step does she make in th
abruzzese [7]
Heading selection on Word Document
8 0
3 years ago
When copying Word document content to an Excel spreadsheet, how many paste options are available from the Paste Options button?
solniwko [45]
The answer is B two. Excel gives you the option to Keep Source Formatting or Match Destination Formatting. 

Hope this help :-)

5 0
3 years ago
Read 2 more answers
The picture that graphically represents the items you use in windows is called a/an
Marizza181 [45]
The picture that represents the items or programs is called a icon, you can change the icon or delete it
4 0
3 years ago
Read 2 more answers
Difference between multidimensional arrays and an example​
weqwewe [10]

Answer:

The generic data structure of a n-dimensional array is a tensor.

An example with 3 dimension can be a cube that contains the following dimensions: users, items, time. That cube can represent the interactions of  users with verifiied pages of public interests (influencers or company/media pages) in time slots (e.g. weekly timeslots).

Explanation:

You can represent in a sparse 3-dimensional array (tensor) the combinations of which user interacted with wich item in a given timeslow.

5 0
3 years ago
Q: Explain the basic units of primary storage and secondary storage.
maksim [4K]

Answer:

Primary memory usually refers to Random Access Memory (RAM), while secondary storage refers to devices such as hard disk drives, solid-state drives, removable “USB” drives, CDs, and DVDs.

7 0
2 years ago
Other questions:
  • When you schedule an appointment, Outlook adds the appointment to the ____ folder by default.
    9·1 answer
  • What security protocol originally came with 802.11 equipment?
    11·1 answer
  • William has an internet connection that does not allow him to make calls when connected to the internet. what internet service c
    7·2 answers
  • You often travel away from the office. While traveling, you would like to use a modem on your laptop computer to connect directl
    5·1 answer
  • A spreadsheet contains the maximum weight and maximum height for fifty dog breeds. The breeds are located in rows, and the weigh
    5·1 answer
  • Find different between manocots and dicots clarify with example​
    14·1 answer
  • Universal Containers is designing a new community using the Customer Community license type. They would like to have the users c
    6·1 answer
  • Given three packets of size 2,500 Bytes (caution this is Bytes not bits) each are ready inside computer 1 to be transmitted onto
    14·1 answer
  • I hate school...............
    13·2 answers
  • True or false? you should avoid using your power point slides as handouts, according to the text.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!