fibonacci...

how one could store no’s big as fib(500)??where fib returns the 500th Fibonacci no.

Use Big Integers.

use the long int ! and call the result by using a boolean variable!

use the long int ! and call the result by using a boolean variable!

use the long int

If your question is language independent, I will suggest you to use Python or other language(s) which have no constraint on the size of integer.
But if you want it in C/C++, use BigInt class for C++. It has member function which allow to perform arithmetic operations on huge numbers. For C, you can create your array, with maximum size as 10^6, and make functions to perform addition, and other operations on two given arrays.

1 Like

use java or python. in c your program may get crashed!!!

by big integers u mean unsigned long long int??

could you plz jst elaborate or give any link to tutorial!!!

1 Like

Since the long long int can only store numbers up to 2^64-1, the 500th fibonacci number won’t fit in. Just search in Wolfram Alpha (search for “500th fibonacci number”). You can either use the BigInteger library supported by your language (for example Python or Java support this) or you have to write it on your own.

dude!! he wants answer in C program not JAVA!!!

long int does not support this big no.

all i want to know is how to handle such a big no and perform arithmetic operations on it…

any guidance will be greatly appreciated

thanku i will look for the bigint class