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]
3 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]3 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
Scale-based classification for networks allows us to differentiate PANs, LANs, MANs, and WANs. Moreover, the structure of a netw
Nana76 [90]

Answer:

1. PANs uses Star Topology.

2. LAN uses four topology (Bus, Ring, Star and Tree).

3. MAN uses Star Topology.

4. WAN uses Bus topology.

Explanation:

1. PAN is the personnel area network, in which different personnel devices of a person are connect to each other with the help of the central computer with the help of Bluetooth, WiFi or some other medium. The central computer will work like a hub and all the devices are directly connected to the central PC. It is same as the ring topology where all the devices are connected to the central PC. So we can say that, PANs use star topology.

2. LAN is the local area network that has been established with in the premises of the organization. In this type of network, four typologies involve to complete the network connection. First is star topology, that is used to connect all the devices with the switches. Then Bus topology is used to connect all the switches with the single main cable. Ring topology is involved to connect all the switches with each other. Tree topology is used to connect different block if the organization in the form of branch to connect the central router or switch.

3. MAN is the Metropolitan Area Network which is comprise of different LANs. All the LANs are connected to the Router in the form of Star topology.

4. WAN is the wide area network. In WAN different MANs are connected to the network through single cable. This type of network uses Bus topology.

6 0
3 years ago
What Are the Components of a Web Address? *​
ipn [44]

Answer:

What Are the Components of a Web Address?

1.Protocol. The first component of a web address is the protocol, which is also known as the scheme. ...

2.Domain Name. The domain name part of the web address is the unique identifier for the website on the internet. ...

3.Domain Extension. ...

4.Path & Filename.

5 0
3 years ago
Read 2 more answers
Steps of booting a computer
Lostsunrise [7]
Steps of Booting
The Startup. It is the first step that involves switching the power ON. ...
BIOS: Power On Self Test. It is an initial test performed by the BIOS. ...
Loading of OS. In this step, the operating system is loaded into the main memory. ...
System Configuration. ...
Loading System Utilities. ...
User Authentication.
8 0
2 years ago
Information Security
ziro4ka [17]

Answer:

THEUNITEDSTATESWASATPEACEWITHTHATNATIONANDATTHESOLIC ITATIONOFJAPANWASSTILLINCONVERsATIONWITHITSGOVERNMEN TANDITSEMPERORLOOKINGTOWARDTHEMAINTENANCEOFPEACEINTH EPACIFICINDEEDONEHOURAFTERJAPANESEAIRSQUADRONSHADCOM MENCEDBOMBINGINOAHUTHEJAPANESEAMBASSADORTOTHEUNITEDS TATESANDHISCOLLEAGUEDELIVEREDTOTHESECRETARYOFSTATEAF ORMALREPLYTOARECENTAMERICANMESSAGEWHILETHIsREPLYSTAT EDTHATITSEEMEDUSELESSTOCONTINUETHEEXIsTINGDIPLOMATIC NEGOTIATIONsITCONTAINEDNOTHREATORHINTOFWARORARMEDATTACK

Explanation:

Use this mapping:

abcdefghijklmnopqrstuvwxyz

kfazsrobcwdinuelthqgxvpjmy

6 0
3 years ago
The material to be broadcast and the way it's arranged is called __________. (10 letters)
ladessa [460]

Answer:

journalism

Explanation:

7 0
3 years ago
Other questions:
  • Liz will use a CD-R compact disk to write to more than once. Carlo will use a CD-RW compact disk to write to more than once. Who
    8·2 answers
  • When performing actions between your computer and one that is infected with a virus, which of the following offers NO risk of yo
    11·1 answer
  • Dallas is an analyst at an online retailer. He is great at creating representative diagrams showing the relationships between cu
    6·1 answer
  • An online journal or diary you create to share your thoughts, opinions and personal news is referred to
    13·1 answer
  • What is the web of trust
    7·2 answers
  • Power delivered to the hitch of tractors is called
    12·1 answer
  • Explain one way in which programmers may get hired.
    9·1 answer
  • Why is it important to have a price assiociated in every product​
    10·2 answers
  • Please help me answering this question
    14·1 answer
  • 7.2.4 Area of Triangle HELP PLEASE!! (JAVA SCRIPT) I WILL WAIT FOR THE SOLUTION.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!