#Why my code is generating more values than initialized in array
12 messages · Page 1 of 1 (latest)
After generating a sequence of 100 fibonacci numbers, it does not stop and keeps generating false values and then at some point it stops
I don't understand why this is happening
If anyone can help
what do you mean by false values?
i ran your code and it generates negative values after some point
that's because it overflows
meaning that an int (which is typically 32 bits) can only represents numbers in the range [2^31, 2^31 - 1]
try using a data type that is able to hold larger values
long, for example