[Solved] using for loop for fibonacci series to print values it will print up to 47 values above that it shows error [closed]


Fib(47) is 2,971,215,073.

2,971,215,073 is larger than 231 – 1 … which is the largest 32 bit signed integer.

Hence your calculation is overflowing. (In a lot of programming languages, you wouldn’t have gotten an error. You would have just gotten the wrong answer.)

How i find the fibonacci series for number 100.

You can’t use simple integer arithmetic. You will need to use the Swift equivalent of Java’s BigInteger class.

  • BigInteger equivalent in Swift?

solved using for loop for fibonacci series to print values it will print up to 47 values above that it shows error [closed]