I need to use this to make a program to find the prime factorization of a number, please help me get started.


input a value to factor
while input value > 1

let leftToFactor = input value
let factor = 2
while factor <= leftToFactor
while factor divides leftToFactor
(i.e. remainder = 0)
output factor
divide leftToFactor by factor
increment factor

input next value to factor

Recommended Answers

All 6 Replies

Looks like you have a decent algorithm there. Now try to translate it to code. Shouldn't be too hard.

Here's a good starting point:

int main() {
}

Can't you help me a bit more please?

I think that i should look for another forum where people are willing to help.

For those other people, any help, please?

You haven't given us any direction what you need help with. We will not write the code for you, but with the lack of details you've given, that's all we can do.

Start by writing the code to input your value. If you can do that, we might be able to help further.

Here is my advice:
You've come up with an algorithm, so now try translating that to code yourself. Come back here and make another post if you hit any problems with your code.

If you do have any problems, remember to be as clear as you can about the nature of the problem and post the code segment that is giving you the problem. Oh and don't forget to use code tags to enclose your code in your post!

As things stand, I think that's about the best advice you're going to get here.

BTW: Did you even search the forum for threads relating to prime factorization before making your post? If you had done, you almost certainly would have found something that you could use to make a start on your own coded solution. I hardly think you're the first person ever to come to this site with problems relating to prime factorization!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.