If you want the range and are willing to give up the accuracy, you could make the product a floating-point number rather than an integer.
Hello i've not seen your code, but i think that it's not possible with integers at least (don't know if you can program a number type the bit-size you want). But, if we factorize 999, we get 999=3*3*3*27, so we get that every product combination of this four numbers we get a really high number. Imagine just (3)*(3*3)*(3*3*3)*(3*27)*(3*3*27)*(3*3*3*27). Imagine what would happen with a bigger number. Impossible for an integer to hold all this.
EDIT: the result is 10460353203
Last edited by kiknewbie; 02-01-2009 at 03:12 AM.
Last edited by vart; 02-01-2009 at 04:12 AM.
All problems in computer science can be solved by another level of indirection,
except for the problem of too many layers of indirection.
– David J. Wheeler
okay, so i understand why it does that, but is there a solution? more specifically, is there a solution that a student in an introductory course should do?
either way, id really like to know.
thanks for the help
edit:
i made it a <float> and i still got a negative number.
Last edited by ominub; 02-01-2009 at 03:20 PM.
okay i figured it out. it does have to be a float, but i forgot to change the %d to a %f. rookie mistake.
oh well... thank you for all your help. i learned a lot.