Computer Science, asked by shahvishakha9011, 10 months ago

Write an algorithm to find the prime factor of a number.

Answers

Answered by anujrathod314
0

Explanation:

is this question is related to coding

Answered by iadarsh
0

Answer:

Explanation:

Algorithm to find the prime factor of a number:

START

Input a number from the user. Store it in some variable say N.

Run a loop from 2 to N/2, increment 1 in each iteration. The loop structure should look like for(i=2; i<=N/2; i++).

You may think why loop from 2 to N/2? Because prime number starts from 2 and any factor of a number N is always less than N/2.

Inside the loop, first, check if i is a factor of N or not. If it is a factor then check it is prime or not.

Print the value of i if it is prime and a factor of N.

END

Similar questions