C --> how can I get bigger variables sizes?
Posted: Sun Oct 30, 2005 2:35 pm
I am currently coding a program that does some manipulating of the fibonacci series, but I have had problems with numbers being to large for the variable they are held in! I have attached the coe here. Is there a way someone can suggest that I can store the rest of the sequence without an overflow (I need to go up to 100).
Thanks in advance,
OScoder
Code: Select all
#include <stdio.h>
int main()
{
//create cariables
unsigned long long sequence[100];
int current_n;
int i;
char input[256];
//initialise variables
sequence[0]=0;
sequence[1]=1;
for(i=2; i<25; i++)
sequence[i]=sequence[i-1]+sequence[i-2];
for(i=2; i<25; i++){
printf("%d \n",sequence[i]);}
scanf("%s", input);
return;
}
OScoder