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
Describe how a black and white image could be represented in binary
SIZIF [17.4K]

Answer:

Each pixel in an image is made up of binary numbers. If we say that 1 is black (or on) and 0 is white (or off), then a simple black and white picture can be created using binary. To create the picture, a grid can be set out and the squares coloured (1 – black and 0 – white).

5 0
3 years ago
Read 2 more answers
What is the oldest malware victor
arsen [322]

Answer:

The oldest malware vector was emails.

Explanation:

Websites were not widespread early on into the internet, however it was very easy to have a virus that uses an email contact list, where it can send itself to other email addresses and spread.

7 0
3 years ago
Create a program that contains 4 methods / functions... main(), getTestScores(), calcAverage(), and displayAverage(). The main()
jeyben [28]

Answer:

import java.util.Scanner;

public class  num6{

   static int getTestScores(){

       System.out.println("Enter the Score");

       Scanner in = new Scanner(System.in);

       int score = in.nextInt();

       return score;

   }

   static double calcAverage(int score1, int score2, int score3){

       return (score1+score2+score3)/3;

   }

   static void displayAverage(double ave){

       System.out.println("The Average is "+ave);

   }

   public static void main(String[] args) {

       int num1 = getTestScores();

       int num2 = getTestScores();

       int num3 = getTestScores();

       //Calling Calculate Average

       double average = calcAverage(num1,num2,num3);

       //Calling displayAverage

       displayAverage(average);

   }

}

Explanation:

  • Using Java programming Language
  • Create the four methods
  • getTestScores() Uses the Scanner Class to receive an in variable and return it
  • calcAverage() accepts three ints as parameter calculates their average and return it
  • displayAverage() Accepts a double and prints it out with a concatenated string as message
  • In the Main Method, getTestScores is called three times to obtain three numbers from the user
  • calAverage is called and handed the three numbers
  • printAverage is called to output the calculated average
8 0
3 years ago
Inherent flaws in system software code are called:
antiseptic1488 [7]
It is called vulnerabilities 
7 0
3 years ago
Suppose we have a relation schema R(A, B, C) with FD A rightarrow B. Suppose also that we decide to decompose this schema into S
4vir4ik [10]

Answer:

Check the explanation

Explanation:

A relation schema is the fundamental schema for a table. Which is In a relational kind of database (what individuals naturally refer to when they talk about database) each take can be referred to as a "relation" . therefore a relational schema is the design for the table.

kindly check the attached image below to see the step by step solution to the question.

7 0
3 years ago
Other questions:
  • 1- Design a brute-force algorithm for solving the problem below (provide pseudocode): You have a large container with storage si
    10·1 answer
  • What are 2 ways that technology can negatively impact the environment.
    8·2 answers
  • How is the Internet Simulator similar to the Actual Internet? How is it different?
    7·1 answer
  • What is the rationale behind the development of an operating system in computing?
    15·1 answer
  • A ________ is a material deficiency, or combination of significant deficiencies, that results in more than a remote likelihood t
    6·1 answer
  • A recursive method without a special terminating case would _________. Hint: Self Check 13.3 had infinite number of isLucky() me
    5·1 answer
  • How do you copy and paste a screenshot on an hd computer
    12·2 answers
  • Your IT manager wants you to set up three computers to appear to users as one powerful Windows Server 2016 server. What capabili
    14·1 answer
  • Websites can have good content for a particular set of search phrases, yet rank poorly. Issues that may cause this to occur incl
    9·1 answer
  • If we need to manage a contiguous range of memory, handling requests to allocate various sized chunks, and later make those chun
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!