Ask Question
14 September, 01:16

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.

+4
Answers (2)
  1. 14 September, 01:24
    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. 14 September, 03:29
    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?
Get 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 there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers