VitorH

Untitled

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