VitorH

Untitled

May 21st, 2012
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.30 KB | None | 0 0
  1. #include <stdio.h>
  2. int main()
  3. {
  4.     float i,a=1,b=1,c=0,n;
  5.     printf("Digite o valor de n para descobrir o n-esimo termo da sequencia de Fibonacci: ");
  6.     scanf("%f",&n);
  7.     for (i=1;i<=n;i++)
  8.     {
  9.         a=b;
  10.         b=c;
  11.         c=b+a;
  12.     }
  13.     printf("%.0f\n",c);
  14.     return(0);
  15. }
Advertisement
Add Comment
Please, Sign In to add comment