[Solved] Fibonacci series incorrectly [closed]


On your system, long is 32 bits. The largest positive integer it can hold is 4294967295.
But 1836311903 + 2971215073 = 4807526976, which is larger, so it overflowed and you got 512559680 (which is 4807526976 – 4294967296). If you want to go past the 47th Fibonacci number, you’ll need a larger datatype or do multi-precision arithmetic.

3

solved Fibonacci series incorrectly [closed]