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
__________ delivers a comprehensive and accurate graphical overview of key performance indicators, often using a single screen.
Irina18 [472]
The answer is a digital dashboard.

In its simplest form, a digital dashboard or a business dashboard provides a graphical representation of KPIs, measures and metrics used by a company to monitor performance of departments, individuals, teams or the entire company. They track the progress of business objectives and make effective data driven decisions.



6 0
3 years ago
In the application development area, ____________ often refers to bringing together various sources of data to create a new prod
Vinvika [58]

Answer:

mashup

Explanation:

In the application development area, mashup often refers to bringing together various sources of data to create a new product with unique value.

8 0
2 years ago
To<br> a<br> Question I<br> Explain why microsoft Excel is referred<br> preashent package -
ikadub [295]

Microsoft Excel is a spreadsheet program included in the Microsoft Office suite of applications. ... Spreadsheets present tables of values arranged in rows and columns that can be manipulated mathematically using both basic and complex arithmetic operations and functions.

.

6 0
2 years ago
In IDLE, which symbols are used for the prompt? <br>*** <br>&lt;&lt;&lt;<br> &gt;&gt;&gt;<br> ---​
Norma-Jean [14]

Answer: >>>

Explanation:

just finished the test and got this right

7 0
3 years ago
n the lab, the Ethernet II detail of the provided packet capture file indicated that Wireshark had determined that the _________
inysia [295]

Answer:

D

Explanation:

In the lab, the Ethernet II detail of the provided packet capture file indicated that Wireshark had determined that the type of traffic carried in the next layer was Internet Protocol (IP).

6 0
3 years ago
Other questions:
  • A network technician configures a firewall’s ACL to allow outgoing traffic for several popular services such as email and web br
    7·1 answer
  • The CPU package is installed using the ____ process
    7·1 answer
  • One foot equals 12 inches. Write a function named feet_to_inches that accepts a number of feet as an argument and returns the nu
    15·1 answer
  • Which of the following is true about scalability?
    9·1 answer
  • A lost update occurs when
    15·1 answer
  • Describe a sub routine​
    8·1 answer
  • If you could represent yourself with one object from your home what would it be ?
    9·2 answers
  • I will make you brainless Just answer this question!!
    9·1 answer
  • A web-based program that uses artificial intelligence techniques to automate tasks such as searches is called
    8·1 answer
  • A machine that converts energy to useful work.
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!