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
NISA [10]
3 years ago
7

The "odd/even factorial" of a positive integer n is represented as n and is defined non-recursively as: (n)(n-2)(n-4)...(4)(2) i

f n is even and is (n)(n-2)(n-4)...(5)(3) (1) if n is odd. For example 7 equals 7*5*3*1 or 105 and 6 equals 6*4*2 or 48. Come up with a recursive definition for n and use it to guide you to write a method definition for a method called oddevenfact that recursively calculates the odd/even factorial value of its single int parameter. The value returned by oddevenfact is a long..
Computers and Technology
1 answer:
adoni [48]3 years ago
3 0

Answer:

The function definition to this question can be described as follows:

long oddevenfact(int y) //defining a method oddevenfact

{

//defining conditional statement    

if (y>2) //check value is greater then 2

{

return( oddevenfact(y-2) * (long) y); //return value

}

else //else

{

return((long) y); //return its value

}

}

Explanation:

The description of the above method definition can be described as follows:

  • In the above method definition a long method "oddevenfact" is declared, which accepts an integer variable "y" as its arguments, and return value as long.
  • Inside the method, a conditional statement is used, in if the block, it checks a value, that is value is greater then 2, and inside the block, a recursive function is used, that calculates its factor, and returns its value in long type.  
  • If the condition is not true, it will go to else block and return in long type value.
You might be interested in
Write a program that reads a file called 'test.txt' and prints out the contents on the screen after removing all spaces and newl
svp [43]

Answer:

I don't know  you should figure that out good luck

Explanation:

good luck

8 0
3 years ago
An audit trail is a record of how a transaction was handled from input through processing and output
Nostrana [21]

The answer is : True.  An audit trail is a record of how a transaction was handled from input through processing and output.  An audit trail is the evidence, such as purchase orders and invoices, that a financial transaction actually occurred.

6 0
3 years ago
What is the body of scientific knowledge based on?
ANTONII [103]
It depend on all such as guess ,observation ,hypothesis and etc
3 0
3 years ago
Read 2 more answers
Even closed systems are never perfectly closed. <br>true false​
Oxana [17]

Answer:

True

Explanation:

You can learn through many different textbooks that a closed system is always closed.

3 0
3 years ago
When hundreds, thousands, or even hundreds of thousands of zombie computers are gathered into a logical computer network under t
Ainat [17]
Virus such as a Trojan or Worm, and can cause network crashes.
4 0
3 years ago
Read 2 more answers
Other questions:
  • I want to customize my company's logo, name, address, and similar details in all my business documents what option should use?
    12·1 answer
  • Tanya is entering the amount of money she has earned from babysitting onto an Excel spreadsheet, but the AutoComplete feature is
    7·1 answer
  • Field names should NOT start with a(n) -<br> hyphen (-)<br> Oa<br> asterisk (*)<br> space()
    8·1 answer
  • _____ _____ deals with the definitions properties of mathematical models of computation.
    8·1 answer
  • Which of the following means to find and fix errors in code?Which of the following means to find and fix errors in code?
    5·1 answer
  • Which statistical function in a spreadsheet helps you to see how far each number varies, on average, from the average value of t
    5·1 answer
  • Project: Math Tutor Program with Error Handling
    9·2 answers
  • Convert this hexadecimal number to binary :. A07F​
    14·1 answer
  • A python program for the following output using for loop.
    13·1 answer
  • Ten ways ict has helped in social development
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!