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
umka2103 [35]
2 years ago
8

Design an algorithm for finding all the factors of a positive integer. For example, in the case of the integer 12, your algorith

m should report the values 1, 2, 3, 4, 6, and 12
Computers and Technology
1 answer:
Nadya [2.5K]2 years ago
3 0
As I say to every one requesting programming help on these forums. If you don't specify a language, then it just means you'll have to translate the answer that is given to you, to a different language. Here's what you want in Java:


<span>import java.util.InputMismatchException<span>;
</span>import java.util.Scanner<span>;
</span>
public class Test {
    public static void main(String[] args) {
        int number = numInput()<span>;
</span>        printFactors(Math.abs(number))<span>;
</span>    }

    private static int numInput() {
        Scanner sc = new Scanner(System.in)<span>;
</span>
        System.out.print("Enter number: ")<span>;
</span>
        int input<span>;
</span>        while (true) {
            try {
                input = sc.nextInt()<span>;
</span><span>                break;
</span>            } catch (InputMismatchException e) {
                System.out.println("Not a number.")<span>;
</span>            }
        }

        return input<span>;
</span>    }

    private static void printFactors(int number) {
        if (number == 0) {
            System.out.println("Infinite factors.")<span>;
</span>        } else {
            for (int i = 1; i <= number; i++) {
                for (int j = 1; j <= number; j++) {
                    if (i * j == number) {
                        System.out.print(i + ", ")<span>;
</span>                    }
                }
            }
        }
    }
}</span>
You might be interested in
What is Hadoop?
balu736 [363]

Answer:

software framework for supporting distributed data processing and storage.

Explanation:

3 0
3 years ago
How does theatre compare with movies or television? What makes it similar to movies and television? What makes it different?
givi [52]

Answer:

you cant mess up in theatre but you can redo scences in movies, thay both have acting in them

Explanation:

im a theatre person

3 0
3 years ago
What type of network access control uses Active Directory to scan a device to verify that it is in compliance?
Komok [63]

Answer:

Agentless NAC

Explanation:

An active directory is a kind of storage service that holds data of objects like user credentials, resource location etc, for permission and network access authentication.

Network access control is a form of computer network security that integrates security technology like antivirus, intrusion detection and prevention systems etc to system authorisation and authentication processes to control access to a network.

An agentless network access control uses the active directory to scan devices to confirm its compliance to security policies.

3 0
3 years ago
____allow(s) visually impaired users to access magnified content on the screen in relation to other parts of the screen.
Ksenya-84 [330]
I think the answer is Screen Magnifiers
5 0
3 years ago
Write on the importance of Computer application to statistics​
tatyana61 [14]

Answer:

Another way to categorise the relation statistics-computer is to list the different ways the computer can be used in statistics. The following are examples of such uses: numerical and graphical data analy- sis; symbolic computations; simulations; storing statistical knowledge; presentation of results.

Explanation:

5 0
3 years ago
Other questions:
  • Somebody who is good at this stuff, please halp meh ;-;
    6·1 answer
  • When does state law require drivers to use their headlights (6)
    11·2 answers
  • Which of the following is a special-purpose computer that functions as a component in a larger product?
    6·1 answer
  • Problem 1: Create a list that contains the months of the year. Problem 2: Create a loop to print the month number and name (do n
    7·1 answer
  • Samira works for a large U.S. company that has factories all over the world. Samira returned to the U.S. after visiting several
    9·1 answer
  • What is one benefit of using electronic sticky notes ?
    9·2 answers
  • How does the use of the computer impact businesses
    13·1 answer
  • How do you do 3.4.5 Add parentheses for code hs? I need answers please
    15·2 answers
  • search engines use software that combs the web to find webpages and add new data about them to the database. what is this softwa
    5·1 answer
  • 1.erros can easily be ____ 2.work is done in an ____ no mess environment 3.colors do not _____ and brushes are never ______ 4.st
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!