-
big int
hey im writing a program to solve this puzzle at slyfx. I need to calculate the fibonacci of numbers from 0-10000. I figured out the program but i need to know what variable can hold such big numbers as it starts rounding after 49. i have tried long double, long int, unsigned logn int....any suggestion???
here is the code
Code:
#include<stdio.h>
#include<string.h>
int main()
{
unsigned long int a=0,b=1,count=2,c;
printf("0\n1\n");
while(count<=10000)
{
c=a+b;
printf("%lu\n",c);
a=b;
b=c;
count++;
}
return 0;
}
-
-
that doesnt offer much help
-
Use Google.
Use strings (Array of character pointers).
Copy.
Paste.
Add quotes.
Season to taste.
Or, go find a large math library. There is no standard value in C, unless you have a compiler that will support 64bit vlaues, that will work.
Quzah.