- Feb 3, 2005
- 7,326
- 2
- 76
Ok, I'm supposed to make a code that will give me the number in Pascal's triangle based on the row and column values I give it.
I have everything working well up until something like (50, 4), which gives me a "divide by zero" error. I understand this is because int values can only go up to 2 billion (or something) before things get weird.
Changing it to doubles fixed it...but apparently I'm not allowed to use doubles for this code (needs to be int).
I'm also not supposed to use division in the code...even though the super easy formula to find a value if given the row and column is row!/(col!(row-col)!). I had to make a factorial helper for this.
I'm not exactly sure what else to do. Obviously I'm just missing some sort of method or algorithm to go about doing this problem some other way.
So, I guess this isn't a total programming question...but I didn't know where else to put it.
I have everything working well up until something like (50, 4), which gives me a "divide by zero" error. I understand this is because int values can only go up to 2 billion (or something) before things get weird.
Changing it to doubles fixed it...but apparently I'm not allowed to use doubles for this code (needs to be int).
I'm also not supposed to use division in the code...even though the super easy formula to find a value if given the row and column is row!/(col!(row-col)!). I had to make a factorial helper for this.
I'm not exactly sure what else to do. Obviously I'm just missing some sort of method or algorithm to go about doing this problem some other way.
So, I guess this isn't a total programming question...but I didn't know where else to put it.