Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <fstream>
  4. #include <iomanip>
  5. using namespace std;
  6. unsigned x,y,z,n,m,i;
  7.  
  8. void f(unsigned x, unsigned y, unsigned z, unsigned k)
  9. {
  10. int w;
  11. w=x+y-z;
  12. if(n!=k-1) f(y,z,w,k-1);
  13. cout<<w<<' ';
  14. }
  15. int main()
  16. {
  17. cin>>n>>x>>y>>z;
  18. fin:if(n<=3)
  19. {
  20. if(n==3)
  21. {
  22. cout<<z<<' '<<y<<' '<<x;
  23. return 0;
  24. }
  25. else if(n==2)
  26. {
  27. cout<<z<<' '<<y;
  28. return 0;
  29. }
  30. else
  31. {
  32. cout<<z;
  33. return 0;
  34. }
  35. }
  36.  
  37. f(x,y,z,n-3);
  38. n=3;
  39. goto fin;
  40. return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement