Advertisement
Guest User

Sequencia Fibb

a guest
Sep 19th, 2014
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.  
  7. int fn, n, prox, ant=0, atual=1, cont=0, acum=0;
  8. printf("Digite o numero de termos da sequencia");
  9. scanf("%i", &n);
  10.  
  11. printf("0 1");
  12. for(cont=2;cont>=n;cont++){
  13. prox=atual+ant;
  14. printf("%A sequencia e:%d", prox);
  15. ant=atual;
  16. atual=prox;
  17.  
  18. }
  19. return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement