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

In mathematics, the factorial of a positive integer n, denoted as n! , is the product of all positive integers less than or equa

l to n.
The factorial of n can be computed using the following rules.

Case I: If n is 1, then the factorial of n is 1.
Case II: If n is greater than 1, then the factorial of n is equal to n times the factorial of (n - 1).
The factorial method returns the factorial of n, as determined by case I and case II. Write the factorial method below. You are encouraged to implement this method recursively.

/** Precondition: n is between 1 and 12, inclusive.

* Returns the factorial of n, as described in part (a).

*/

public static int factorial(int n)
Computers and Technology
2 answers:
MrRa [10]3 years ago
6 0

Answer:

public static int factorial(int n) {

   

    if (n >= 1 && n <=12) {

           if (n==1)

               return 1;

           else

               return n * factorial(n-1);

    }

    else

        return -1;

}

Explanation:

Create a method called factorial that takes one parameter, n

Check if n is n is between 1 and 12. If it is between 1 and 12:

Check if it is 1. If it is 1, return 1. Otherwise, return n * function itself with parameter n-1.

If n is not between 1 and 12, return -1, indicating that the number is not in the required range.

For example:

n = 3  Is n==1, NO factorial(3) = n*factorial(2)

n = 2  Is n==1, NO factorial(2) = n*factorial(1)

n = 1  Is n==1, YES factorial(1) = 1.

Then factorial(2) = 2*1 = 2, factorial(3) = 3*2 = 6

Elis [28]3 years ago
4 0

Answer:

Explanation:

public static int factorial(int n){

if (n<=1){

return 1:

}else if (n>1 && n<=12){

return n * factorial(n - 1);

}

}

int  main() {

printf( "Enter a value :");

  scanf("%d", &n);

  printf("Factorial of %d is %d\n", n, factorial(n));

  return 0;

}

You might be interested in
what are some of the challenges that could arise from setting up a file management system on a computer
seropon [69]
A virus maybe or ransomware
7 0
3 years ago
A penetration testing service hired by the company has reported that a backdoor was identified on the network. What action shoul
sergij07 [2.7K]

An action which this organization should take to find out if systems have been compromised is: C. Look for unauthorized accounts.

<h3>What is a penetration test?</h3>

A penetration test can be defined as a cybersecurity technique that simulates a cyber attack against an end user's computer system, so as to scan, identify, test and check for exploitable vulnerabilities and compromises in the following:

  • Operating system
  • Web software
  • Host device
  • Network

This ultimately implies that, a penetration test avails a tester the ability to exploit a weakness and potential security threats on a test network as a privileged user, during vulnerability assessments of the computer system.

In this scenario, we can reasonably infer and logically deduce that an action which this organization or cybersecurity specialist should take to find out if systems have been compromised is to look out for unauthorized accounts.

Read more on penetration test here: brainly.com/question/25813524

#SPJ1

Complete Question:

A penetration testing service hired by the company has reported that a backdoor was identified on the network. What action should the organization take to find out if systems have been compromised?

Look for policy changes in Event Viewer.

Scan the systems for viruses.

Look for unauthorized accounts.

Look for usernames that do not have passwords.

7 0
11 months ago
To achieve the maximum confidentiality and integrity found in a completely secure information system would require that the syst
fgiga [73]

Answer:

The answer is "Option a".

Explanation:

Privacy is a set of rules, which limiting access to the data, and integrity ensures impartiality, accuracy, and reliability is assured to ensure, which authorized persons can have secure access to the data.

The system needs no access for everyone to achieve its secrecy and integrity contained in a completely safe data system, that's why the given statement is "true".

5 0
3 years ago
Are u a chicken nugget!!??
creativ13 [48]
Yes. Yes I would classify myself as the nugget of the chicken thank you for asking me. 
3 0
3 years ago
Read 2 more answers
What kind of eolr would you need to not have a open trouble on the facp
zhannawk [14.2K]

Answer:

here are three basic categories for fire alarm panel signals: trouble, supervisory, and alarm. Trouble Signal. A trouble signal is typically designated by a yellow light and means that there is an operational issue. For some more advanced systems, the panel may indicate the kind of problem and where it is located.

Explanation:

8 0
3 years ago
Other questions:
  • <img src="https://tex.z-dn.net/?f=3x%20-%205%20%3D%203x%20-%207" id="TexFormula1" title="3x - 5 = 3x - 7" alt="3x - 5 = 3x - 7"
    12·1 answer
  • Henry uses a laptop and has noticed that sometimes when he is typing, the cursor will move, causing him to mistype words or even
    12·1 answer
  • Amazon.com uses a customer profiling system whenever a customer visits its website. using this system, amazon can offer products
    6·1 answer
  • Using the spreadsheet below, which formula can be used to determine Albert's hourly wage?
    6·2 answers
  • Most 4 year colleges want an applicant's scores for all the following except
    12·1 answer
  • Do you think lossy compression formats will be popular in 20 years? Why or why not?
    10·1 answer
  • Create a dictionary that maps a fruit name to its color. Both the keys and the values should be stored as strings. Include only
    7·1 answer
  • Meaning and explanation of fortran​
    11·2 answers
  • Microsoft Word cannot be used to create personalized web<br> pages.<br> OTrue<br> False
    7·1 answer
  • (Language: Python) How can you know what value is in a variable by looking at the code?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!