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
STALIN [3.7K]
3 years ago
15

Write a function in Java called factorial() that will take a positive integer as input and returns its factorial as output.

Computers and Technology
1 answer:
serg [7]3 years ago
4 0

Answer:

The function is as follows:

public static int factorial(int n){

       int fact = 1;

       for(int i=2;i<=n;i++){

           fact*=i;

       }

       return fact;

   }

Explanation:

This line defines the function

public static int factorial(int n){

This declares and initializes variable fact to 1    

  int fact = 1;

This iterates from 2 to n

       for(int i=2;i<=n;i++){

This line multiplies all integers from 1 to n

           fact*=i;

       }

This returns the factorial

       return fact;

   }

You might be interested in
What was the first computer programming language?
diamong [38]

Answer:

The answer is B.COBOL

Explanation:

I took AP EX quiz.

5 0
2 years ago
There are___standard colors for text in a theme.
Stella [2.4K]
There are two standard colors for a text in a them
6 0
4 years ago
If you have downloaded this book's source code from the companion Web site, you will find a file named text.txt in the Chapter 1
Lubov Fominskaja [6]

Answer:

Explanation:

The following python code loops through each line within a file called text.txt and counts all the words, then it divides this count by the number of sentences in the text file. Finally, output the average number of words per sentence.

f = open("text.txt", "r")

all_words = 0

sentences = 0

for x in f:

   list = x.split(' ')

   all_words += len(list)

   sentences += 1

average = all_words / sentences

print("There are an average of " + str(average.__round__()) + " words in each sentence.")

6 0
3 years ago
When you tap or click the ____ button for a selected graphic, Word provides options for changing how a graphic is positioned wit
Snowcat [4.5K]
<span>You have to click on "layout options" to enable you to change the positioning of a graphic within a Word document. You will be able to change how the graphic wraps around text, is scaled to the page/document and if it should have borders etc around it.Hope this helps. Let me know if you need additional help!</span>
5 0
3 years ago
_____ targeting techniques increase the effectiveness of banners, rich media, and video ads.
Delvig [45]

Banner, rich media, and video ad effectiveness is increased through behavioral targeting strategies.

<h3>What are Behavioral targeting techniques?</h3>
  • A marketing strategy called "behavioral targeting" makes use of data about web users to enhance advertising campaigns.
  • The method entails obtaining information on a potential customer's web browsing and purchasing habits from a range of sources.
  • In order to assess which advertisements and messages will be most effective with a certain audience, behavioral targeting is used.
  • To launch personalized marketing, it makes use of behavioral data, such as what users do or don't do in your app, on your website, or with your campaigns.
  • An illustration of behavioral targeting would be if a customer frequently visited a website with evaluations of thermometers for home use or conducted a search for thermometers, then went to a website for the producer of thermometers.

To learn more about  Behavioral targeting techniques, refer to:

brainly.com/question/28025161

#SPJ4

4 0
2 years ago
Other questions:
  • 21. What is the set of events that occurs between the moment you turn
    7·1 answer
  • The isometric projection camera technique provides an illusion of perspective by using things like parallax scrolling to create
    10·1 answer
  • True/False
    13·1 answer
  • When you use an external style sheet with an HTML document, you get all but one of the benefits that follows. Which one is NOT a
    15·1 answer
  • Write a program that receives an character and displays its Unicode. Here is a sample run: Enter an character: E The Unicode for
    8·1 answer
  • JPG is considered a lossy file format. What does this mean?
    15·2 answers
  • You can use this keyboard shortcut to toggle the visibility of the command line. If for some reason your command line is hidden
    7·1 answer
  • What is the first things u do upon seeing this sheet?​
    14·2 answers
  • Which system provides an easier way for people to communicate with a computer than a graphical user interface (GUI)
    6·1 answer
  • Select the correct answer.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!