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
Who is the father of computer​
r-ruslan [8.4K]

charles babbage is the father of computer's

3 0
3 years ago
Read 2 more answers
What is the reason that friction is present in surface to surface contact?
Andrej [43]
One surface is larger than the other surface
3 0
3 years ago
Matthew is working to select an authentication method for his company that will support REST as well as many web-based and mobil
vitfil [10]

Answer:

C) OpenID Connect

Explanation:

The best option is OpenID Connect because is based in OAuth, and supports multiple web based and mobile clients, and supports REST.

With OAuth, we cannot make any user authentication just provide a token to access data.

RADIUS is a networking protocol, and Shibboleth is a single sign-on log-in system for computer networks and the Internet, both not support REST.

6 0
3 years ago
The Counter Pattern
kumpel [21]
You'll probably see numbers counting up, like 1 2 3 4 ...
6 0
3 years ago
Look at the options below. Which one is a simulation?
Elena-2011 [213]

Im going to guess the 2nd one.

The 1st one just shows how trees can make ____ and then goes to water, the sun, then the rain but it CAN be used as one.

The 2nd one seems to explain the best it can show about weather, water, landforms, the sun, and seems like a better one to choose.

5 0
3 years ago
Other questions:
  • 1. Which markup language adds the ability to use video without requiring the user to download add-ons?
    13·1 answer
  • The computers that run the DBMS and all devices that store database data should reside in locked, controlled-access facilities.
    15·1 answer
  • __________ offers a mechanism to accomplish four security goals: confidentiality, integrity, authentication, and nonrepudiation.
    9·1 answer
  • Which of the following best describes a group?
    13·1 answer
  • Manuel has set up his network so that some employees can open and view files but are unable to edit them. Others can open, view,
    10·1 answer
  • Define additional characteristics such as font weight or style for an html tag
    5·1 answer
  • You are in the middle of a big project at work. all of your work files are on a server at the office. you want to be able to acc
    14·1 answer
  • Any fact or set of facts, such as the words in a letter to a friend or the notes in a song, can become computer ____.
    7·1 answer
  • Multi-part question:
    13·1 answer
  • Which automatic startup option should you choose when windows' startup fails immediately after installing a new driver but befor
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!