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

formula to convert 2500mmh2o into m3/hr

507


Why C language is a procedural language?

626


What is function and its example?

635


How #define works?

628


Why flag is used in c?

660






What is far pointer in c?

818


What is the newline escape sequence?

596


Are pointers really faster than arrays?

575


Explain high-order bytes.

681


Which is better between malloc and calloc?

678


struct screen_pos{ int row, col } ;move_right(cursor)struct screen_pos *cursor;{ cursor.col++; } /* This statementhas a syntax error */What is the correct statement a) cursor.col = cursor.col + 1; b) col.cursor++; c) *cursor.col++; d) pointer

772


How are portions of a program disabled in demo versions?

762


How macro execution is faster than function ?

676


What is function prototype in c with example?

584


How is a structure member accessed?

592