Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // calcular os primeiros n números da sequência de fibonacci
- // f_n = f_(n-1) + f_(n-2)
- #include <stdio.h>
- int main(void)
- {
- long i,a,b,c;
- a=0;
- b=1;
- c=1;
- for (i=0;i<=100;i++)
- {
- c=a+b;
- a=b;
- b=c;
- printf("%d\n",c);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement