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 is the difference between a surge and a spike?
Anna [14]
D, I think. I may be wrong. Someone comment and tell me
3 0
3 years ago
Can someone let me join your kingdom if anybody knows this game and plays it as well. ​
Assoli18 [71]

Answer:

sure is called voxetas

Explanation:

7 0
3 years ago
Who invented slide Rule and when?​
podryga [215]
Invented by William Oughtred in the 1600s but only used in the mid 1800s
3 0
3 years ago
Read 2 more answers
Pleeeese help me for these questions
geniusboy [140]

1 Account

2 online

3 access

4 password

5 internet

6 email

4 0
3 years ago
A fast food chain that wants to inform consumers about its latest dollar menu item will most likely use ___ to do so. ____ may i
Eva8 [605]
The correct answer is 1: B new tech and 2:C we can tell by the way businesses are incorporating things like social media like how Wendys got more popular because of their sassy tweets
3 0
3 years ago
Read 2 more answers
Other questions:
  • 25. Becca is learning how to brush her teeth independently and her therapist/RBT has created an activity schedule to help teach
    6·1 answer
  • HELP AS SOON IS A UNIT TEST WILL GIVE BRAINLIEST
    9·2 answers
  • Create a file account.cpp containing a Bank Account Class.
    11·1 answer
  • You must. place a child in a federally approved child restraint device. if the child is
    5·2 answers
  • Create a text file named employee.dat containing the following data: b. Write a C++ program to read the employee.dat file create
    6·1 answer
  • Overview
    7·1 answer
  • Write its features:features of computer ​
    15·1 answer
  • What is the most common type of storage device for transferring files from one computer to another?
    10·1 answer
  • A laptop can be kept on palm to work. [true/false) ​
    5·1 answer
  • 3
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!