Ask Question
13 January, 04:42

Design an algorithm (expessed in pseudocode) for finding all the factors of the positive integer for example in the caseof the integer 12, your algorithm should report 1, 2, 3, 4, 6 and 12.

+1
Answers (2)
  1. 13 January, 05:26
    0
    We must use the % operator, which returns the remainder of a division. The code would include a loop which would count up to, or down from, the number being checked. If counting up, the loop would start at 1 and the counter will be incremented by 1 until it becomes equal to the number being checked.

    If we are counting down from the number, the counter will be decremented by one until it is 0. The loop will divide the given number by the value of the counter using the % operator and check if the answer is 0. If it is, then the value of the number will be saved as a factor, if not, the loop will continue.
  2. 13 January, 08:27
    0
    For this we can use % operator which gives us remainder when dividing.

    Let x be the number which factors we want to find out.

    let c represent consecutive integer numbers from 0 to x

    if x%c = 0 that means that c is factor of number x
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Design an algorithm (expessed in pseudocode) for finding all the factors of the positive integer for example in the caseof the integer 12, ...” in 📘 Mathematics if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers