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
In the Microsoft publisher application, words underlined in red are ____.
nydimaria [60]

In the Microsoft publisher application (as well as many other websites such as Brainly, Google docs, etc), words underlined in red are spelled incorrectly.

Whether you spelled it incorrectly or did not complete the words, as long as the word is not found in the dictionary, the word would be underlined with a red squiggly line.

~

4 0
3 years ago
________ is a record in a relational database.
leonid [27]

The answer that is a record in a relational database is called; A row

<h3>What is a record in relational database?</h3>

In relational databases, a record is defined as a group of related data held within the same structure. Furthermore, we can say that a record is a grouping of fields within a table that reference one particular object.

Now, in relational database, a row is called a record because each row, contains a unique instance of data or key for the categories defined by the columns.

Read more about Relational Database at; brainly.com/question/13262352

#SPJ12

4 0
1 year ago
Who do you understand by term DATA give example? please give answer in own words​
xeze [42]

Answer:

The term data is simply defined as “facts and figures”. Each piece of data is a little fact that doesn't mean much on its own. The word data can be used for a singular fact or a collection of facts. It comes from the Latin word datum, meaning “something given”.Data is defined as facts or figures, or information that's stored in or used by a computer. An example of data is information collected for a research paper. An example of data is an email. ... Statistics or other information represented in a form suitable for processing by computer.

4 0
2 years ago
Read 2 more answers
From the binary search algorithm, it follows that every iteration of the while loop cuts the size of the search list by half.
Colt1911 [192]

Answer:

True: In binary search algorithm, we follow the below steps sequentially:

Input: A sorted array  B[1,2,...n] of n items and one item x to be searched.

Output: The index of x in B if exists in B, 0 otherwise.

  1. low=1
  2. high=n
  3. while( low < high )
  4.  {      mid=low + (high-low)/2
  5.         if( B[mid]==x)
  6.          {
  7.             return(mid)  //returns mid as the index of x
  8.           }
  9.          else
  10.          {
  11.              if( B[mid] < x)      //takes only right half of the array
  12.               {
  13.                 low=mid+1
  14.               }
  15.              else               // takes only the left half of the array
  16.               {
  17.                high=mid-1
  18.               }
  19.           }
  20.  }
  21. return( 0 )

Explanation:

For each iteration the line number 11 or line number 15 will be executed.

Both lines, cut the array size to half of it and takes as the input for next iteration.

6 0
3 years ago
Please answer this question​
RSB [31]

Answer:

what is the other language

is it Assamese clarify me in the comment section bro

4 0
2 years ago
Other questions:
  • Assume the following variable definitions int a = 5, b = 12; double x = 3.4, z = 9.1. What are the values of the following expre
    7·1 answer
  • What do we call a subset of new media in which groups and their fans can interact directly?
    14·1 answer
  • 11. John wants to share resources and move a large volume of data quickly over the Internet. John should use which of the follow
    14·1 answer
  • Identify the computer cycle in each of the descriptions below by choosing the answer from the
    12·1 answer
  • Jump to Question: Fill in the blanks below: The flow of electricty is similar to the movement of water through a pipe. The movem
    15·1 answer
  • A new company will have 40 workstations in one building sharing a single network. All users must be able to share ¬les and print
    7·1 answer
  • Solve(-8/3)+7/5 please answer​
    5·1 answer
  • Before you ever buy your first stock or bond, it's important to understand what type of investor you are. This depends on a numb
    12·1 answer
  • Write an assembly code to implement the y=(x1+x2)*(x3+x4) expression on 2-address machine, and then display the value of y on th
    7·1 answer
  • The while loop and the do loop are equivalent in their expressive power; in other words, you can rewrite a while loop using a do
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!