nikolas_serafini

Lista 3 - Exercício 24

Jun 13th, 2013
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.34 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.     int i,a = 0, b = 0,c = 1,d = 1,max;
  6.    
  7.     printf("Entre com o numero maximo de termos :\n");
  8.     scanf("%d",&max);
  9.  
  10.     printf("\n%d\n",d);
  11.     for (i = 0; i < max-1; i++)
  12.     {
  13.         d = a + b + c;
  14.         printf("%d\n",d);
  15.         a = b;
  16.         b = c;
  17.         c = d;
  18.     }
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment