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
choli [55]
3 years ago
13

Write a function, factors, that takes an integer n, and returns a list of values that are the positive divisors of n. Note: 0 is

not a divisor of any integer, 1 divides every number, and n divides itself.
Computers and Technology
1 answer:
Helen [10]3 years ago
4 0

Answer:

public int[] factors(int n)

{

int arr[]=new int[n];

int count=0;

for(int i=1;i<=n;i++)

if(n%i==0)

{

arr[count]=i;

count++;

}

return arr;

}

Explanation:

Factors are the numbers you multiply to get another number. For instance, factors of 15 are 3 and 5, because 3×5 = 15.

In the program , we have an array of length N to store the factors.

Since we don't know the number of factors of N, so we have taken size of upper bound N to store list of factors in the array arr.

Within the loop the number gets divide by Integers from 1 to that number until result is 0. If it is 0, that number is stored in array.

You might be interested in
Who have a ps4 ?<br> Who have 2k20? <br> Are you good a 2k20 ? <br> Add me on Ps4 eoKyriie
Lena [83]

Answer:

lol i would but i have an Xbox...

Explanation:

4 0
3 years ago
Read 2 more answers
What type of compensation does a travel agent receive from suppliers?
insens350 [35]

The travel agents receive compensation from suppliers such as waiting time compensation, night ride compensation, and cancellation compensation.

<u>Explanation</u>:

  • The travel agents from ola, uber and other companies usually receive compensation such as 10 percent commission of booking fees.  Usually, if the customer cancels the ride the travel agent will receive compensation for that ride.  They also receive time compensation for their work.
  • For long rides, the travel agents will receive extra compensation for that. Because the distance for that ride will be long. So they will receive these types of compensations from suppliers.    

6 0
3 years ago
Read 2 more answers
Write a full class definition for a class named Counter, and containing the following members: A data member counter of type int
vfiekz [6]

// making the class

class Counter {

int counter;

int limit;

// Constructor

Counter(int a, int b){

counter = a;

limit = b;

}

// static function to increment

static increment(){

if(counter<limit)

nCounter+=1;

}

// Decrement function

void decrement(){

if(counter>0)

nCounter-=1;

}

int getValue(){

return counter;

}

static int nCounter;

int getNCounters(){

return nCounter;

}

};

// Initializa the static

int Counter::nCounter = 0;

4 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
Provide code to create a selection list named orderDay containing the values and option text SAT and SUN placed in the Weekend o
harina [27]

Answer:

<!DOCTYPE html>

<html lang="en">

<head>

<!--title for web page -->

<title>Question 1</title>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1">

</head>

<body>

<!-- Creation of selection list -->

<select name="orderDay">

<!-- Creation of Weekday option group-->

<optgroup label="Weekday">Weekday</optgroup>

<option value="MON">MON</option>

<option value="TUE">TUE</option>

<option value="WED">WED</option>

<option value="THU">THU</option>

<option value="FRI">FRI</option>

<!-- Creation of Weekend option group-->

<optgroup label="Weekend">Weekend</optgroup>

<option value="SAT">SAT</option>

<option value="SUN">SUN</option>

</select>

</body>

</html>

Explanation:

The above code can be saved as orderDay.html. When it is clicked open it opens into a browser where we have an output which is a dropdown box showing the days under the weekday group and the days under the weekend opton group.

6 0
3 years ago
Other questions:
  • Using refracted laser light to store data on a photoreceptive substrate is essentially how ___ storage works. Theoretically this
    5·1 answer
  • Read the paragraph.
    12·2 answers
  • What are the pros and cons of editorial anonymity in Wikipedia
    10·2 answers
  • Assume:
    14·1 answer
  • * Create a list of places and situations in which we use a computer
    11·1 answer
  • A user has just reported that he downloaded a file from a prospective client using IM. The user indicates that the file was call
    11·1 answer
  • What is the first step to apply the line and page breaks options to groups of paragraphs in a Word document?
    10·2 answers
  • Why don’t the ads on Brainly load anymore
    14·2 answers
  • DEFINE Problem:
    11·1 answer
  • Real estate management software
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!