People on here don't like downloading stuff from attached files, so it might be better to just use code tags
[code]
Your code goes here...
[/code]
And is looks like this:
'i' doesn't have to be in brackets for you declaration, nor the 0 after the return statement - That shouldn't cause a problem thoughCode:Your code goes here...
Can you be more specific about what the problem is?
Fact - Beethoven wrote his first symphony in C
On second thoughts, you are declaring 'i' twice.
Maybe you want something like this
Note that fi[46] overflows.Code:#include <stdio.h> #include <stdlib.h> int main(void) { int i; int fi[100]; fi[0]=1; fi[1]=1; for(i = 2; i<47; i++) { fi[i] = fi[i-1] + fi[i-2]; printf("%d\n", fi[i]); } return EXIT_SUCCESS; }
Fact - Beethoven wrote his first symphony in C
i am trying to get it to look like
1,1,2,3,5,8,13,21,etc...
sorry im really new to this :/
Did you try the code that I put up?
Fact - Beethoven wrote his first symphony in C
yes and i thank you for that but i would also like it to stop at 100.
You are going to need a larger variable than int then
Perhaps an unsigned 64 bit variable
[edit]Hmm... Maybe that is not big enough as well[/edit]
Fact - Beethoven wrote his first symphony in C
i got it thank you for your help. you got me in the right direction and finished it.
Looks like you are going to need to create your own adding function that can handle big numbers
Fact - Beethoven wrote his first symphony in C