Thread: big int

  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    134

    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;
    }
    Last edited by noob2c; 05-31-2003 at 03:43 PM.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    134
    that doesnt offer much help

  4. #4
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    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.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how to combine these working parts??
    By transgalactic2 in forum C Programming
    Replies: 0
    Last Post: 02-01-2009, 08:19 AM
  2. Replies: 26
    Last Post: 11-30-2007, 03:51 AM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  4. Replies: 2
    Last Post: 03-24-2006, 08:36 PM
  5. Quack! It doesn't work! >.<
    By *Michelle* in forum C++ Programming
    Replies: 8
    Last Post: 03-02-2003, 12:26 AM