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
guajiro [1.7K]
3 years ago
10

Write a recursive, int-valued method named productOfOdds that accepts an integer array, and the number of elements in the array

and returns the product of the odd-valued elements of the array. You may assume the array has at least one odd-valued element. The product of the odd-valued elements of an integer-valued array recursively may be calculated as follows: If the array has a single element and it is odd, return the value of that element; otherwise return 1. Otherwise, if the first element of the array is odd, return the product of that element and the result of finding the product of the odd elements of the rest of the array; if the first element is NOT odd, simply return the result of finding the product of the odd elements of the rest of the array
Computers and Technology
1 answer:
lara [203]3 years ago
4 0

Answer:

Program source code found in explaination

Explanation:

Recursive int function of the asked question.;

int productOfOdds(int array[],int length) {

int product=1;

if(length==0)

return -1;

else if(length==1) {

if(array[length-1]%2!=0)

return array[length-1];

else

return 1;

}

else {

product=productOfOdds(array,--length);

if(array[length]%2!=0) {

product=product*array[length];

}

}

return product;

}

You might be interested in
What would you consider before buying a printer​
Marysya12 [62]

Answer:

Printing Quality, Price, If it van vonnect to my laptop or nay devices.

4 0
2 years ago
Read 2 more answers
After a hard rain, water flows faster in a local creek. This washes away a lot of sediment, making the creek a little deeper.
notka56 [123]
B. The Grand Canyon 
Got this of a Study Island test.  Good Luck!
6 0
3 years ago
Answer ASAP and I'll give brainliest, thanks, and five stars!
Goshia [24]

Answer:

The students who buy lunch are not getting enough time to socialize/ eat lunch because they spent it standing in line

Explanation:

That would be my guess, hope this helps

8 0
3 years ago
Read 2 more answers
Why would you activate more than one nic on a pc?
natima [27]
For redundancy in case of failure or for connecting them to different subnets. 
4 0
3 years ago
What could be a possible problem with relying on public transport she might experience and what could she do about it?
MrRissso [65]

Answer:

Free transit is a poor substitute for making drivers pay actual costs of driving. Free anything makes people use it too much.

Explanation:

8 0
3 years ago
Other questions:
  • The main activity area or the brain of the computer is called the ________
    15·1 answer
  • In order to use an object in a program, its class must be defined.
    9·1 answer
  • Assume that an int variable counter has already been declared. Assume further a variable counterPointer of type "pointer to int"
    10·1 answer
  • Based on your prior knowledge, match each civilization to the region it occupied.<br>​
    12·1 answer
  • Antivirus software products require that you update _____ on a regular basis.
    8·1 answer
  • Write a pseudocode to calculate the volume of a cylinder​
    12·1 answer
  • What is the minimum number of bits you would need to represent a number on a 0 to 10 scale
    15·1 answer
  • What does a computer use long-term memory, or ROM, for?
    13·1 answer
  • If a company gave you a free version of their software and encouraged you to try and improve it and share it with the only commu
    8·1 answer
  • Wirte a program which asks the users to input length and calculates the area of a square.( Area = Length^2)​
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!