Ask Question
15 December, 05:09

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.

+5
Answers (2)
  1. 15 December, 05:11
    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. 15 December, 05:33
    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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers