You are not logged in.
Pages: 1
hey guys! new to programming in general...working on some of the project euler problems. I'm on #14 and I'm getting this weird loop that I can't explain. any help would be appreciated...it's probably just me being a nubhead =P
Basically when it reaches odd numbers it seems to be multiplying them wrong...they're two behind so like when on 61 it'll end up to 182 instead of 184....
Weird part is the program seems to work fine until somewhere between numbers 110,000 and 115,000
Last edited by Stythys (2008-09-20 23:13:17)
[home page] -- [code / configs]
"Once you go Arch, you must remain there for life or else Allan will track you down and break you."
-- Bregol
Offline
You dare post a screenshot of that operating system here ? Naughty naughty!
Last edited by moljac024 (2008-09-20 23:20:21)
The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...
Offline
haha, yeah sorry xD
I'm using windows for about a month until I get my new computer 'cause my graphics card isn't fully supported under linux, and there are no upgrade slots unless I get a new mobo and everything. Just one more month of hell.....lol
[home page] -- [code / configs]
"Once you go Arch, you must remain there for life or else Allan will track you down and break you."
-- Bregol
Offline
For some reason your numbers are all negative so it is really going from -61 to -182 as expected.
You are using a short int for your number (from memory int == short int) and so a suffering roll over. You will want to use an unsigned long for numbers that can be bigger than a million and only positive.
Offline
ahhhhh gotcha. Thanks
[home page] -- [code / configs]
"Once you go Arch, you must remain there for life or else Allan will track you down and break you."
-- Bregol
Offline
Pages: 1