Write a program to generate prime factors of a given integer?

Answer Posted / kalee

Pseudo code: Algorithm ....

If N is the integer, then, any number greater than sqrt(N) will not be a factor of that integer...

so it is enough to check till sqrt(N) integers, that is it is divisible or not... further, if N is odd... forget all the even integers, as they cannot be a part of factors.. :)

Happy coding...

Is This Answer Correct ?    6 Yes 9 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I create a directory? How do I remove a directory (and its contents)?

608


Are comments included during the compilation stage and placed in the EXE file as well?

672


Explain what is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?

643


code for quick sort?

1622


What is the value of uninitialized variable in c?

577






What do you mean by keywords in c?

631


Why c is called a middle level language?

634


What is the -> in c?

585


to print the salary of an employee according to follwing calculation: Allowances:HRA-20% of BASIC,DA-45% of BASIC,TA-10%. Deductions:EPF-8% of BASIC,LIC-Rs.200/-Prof.Tax:Rs.200/- create c language program?

1574


Why is c called "mother" language?

857


What are the different types of C instructions?

679


What are structure members?

599


Explain how does flowchart help in writing a program?

634


a character or group of characters that defines a register,or a part of storage a) memory b) byte c) address d) linear list

632


What is the value of a[3] if integer a[] = {5,4,3,2,1}?

673