factor of number in algorithm
Answers
Answered by
1
Algorithm to calculate the factor of a number:
step 1. Start
step 2. define the variable number and i.
step 3. taking input from user in the number variable
step 4. declare a for loop that starts from 1 and ends with a number variable
step 4. inside a loop a condition defines that (number%i==0)
step 5. print value of i.
step 6. Stop
Explanation:
- In the above algorithm firstly start a process then declare an integer variable that is "number and i".
- In number variable, we take value from the user, and i variable is used to finding the factor of the given number.
- In the next step, a for loop is declare, which uses variable i, which starts from 0 and ends with number variable value.
- Inside a loop, a conditional statement defines, that checks number modular i variable is equal to 0. if this condition is true, it will print factors.
Learn more:
- What is an algorithm: brainly.in/question/2644446
Similar questions