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
8.1 edhesive answer please
Gnoma [55]

Answer:

dont understand what u mean

4 0
2 years ago
Which of the following data types can hold a fractional (decimal) number?
zvonat [6]
A float data type can hold a decimal number.
6 0
2 years ago
This type of program is designed to be transmitted over the internet and run in a web browser
vodomira [7]
This sounds like a web-based application because they are designed to be ran within a website, generally with Adobe Flash.
8 0
3 years ago
In computer programming, what is syntax?
enot [183]

Answer: syntax is a set of rules for grammar and spelling. In other words, it means using character structures that a computer can interpret

6 0
2 years ago
Read 2 more answers
Required skills,training,education for dentist
AlekseyPX

Answer:

Education-Bachelor's degree prior to admission to dental school; doctoral degree in dental medicine or dental surgery; some dental specializations require completion of a residency

Skills- Communication skills. Dentists must have excellent communication skills, Detail oriented, Dexterity, Leadership skills, Organizational skills, Patience, Physical stamina, Problem-solving skills.

Explanation:

7 0
2 years ago
Other questions:
  • The protocol that enables computers on the Internet to communicate with each other is called _____.
    7·1 answer
  • Which code fragment constructs an arrray list named players that is initialized to contain the strings "player 1" and "player 2"
    15·1 answer
  • The __________ vulnerability assessment is a process designed to find and document selected vulnerabilities that are likely to b
    15·1 answer
  • To share a document in my online electronic journal, I should select the option to _____.
    14·1 answer
  • Wite 3 names of computers used in 1st generation of computers?
    12·1 answer
  • In the Dynamic Partitioning technique of memory management, the placement algorithm that scans memory from the location of the l
    11·1 answer
  • 2. a computer system designed to run games is called what?
    11·1 answer
  • What is project scope? a. Quantifiable criteria that must be met for the project to be considered a success b. Products, service
    5·1 answer
  • Which of the following are benefits of designing a scalable system? choose 3 options.
    11·1 answer
  • What does Amara hope will<br> happen when Dad sits on the sofa?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!