Advertisement
Guest User

Untitled

a guest
Oct 30th, 2014
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. int const M=6;
  4. int main()
  5. {
  6. int i;
  7. int x[6] = { 1,8,21,14,-20,-24 };
  8. int c=-2;
  9. int con=M;
  10. /*for(i=0;i<M;i++)
  11. {
  12. printf("\nEnter value for X[%d]: ", i);
  13. scanf("%d", &x[i]);
  14. }
  15. printf("\nEnter value for C: ");
  16. scanf("%d", &c);*/
  17. printf("\n\t[ ] ");
  18. for(i=0;i<M;i++)
  19. {
  20. printf("\t[%d] ", x[i]);
  21. }
  22. printf("\n\t[%d]", c);
  23. printf("\t[%d]", x[0]);
  24. for(i=1;i<M;i++)
  25. {
  26. x[i]=c*x[i-1]+x[i];
  27. }
  28. for(i=0;i<M;i++)
  29. {
  30. printf("\t[%d] ", x[i]);
  31. }
  32.  
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement