Advertisement
Guest User

Untitled

a guest
Nov 21st, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. void xd()
  6. {
  7. int element=3;
  8. int n;
  9. cin >> n;
  10. for(int i=1;i<=n;i++)
  11. {
  12. cout << element << " ";
  13. element = element *2;
  14. }
  15.  
  16.  
  17.  
  18. }
  19.  
  20. void xd2()
  21. {
  22. int element=-10;
  23. int n;
  24. cin >> n;
  25. for(int i=1;i<=n;i++)
  26. {
  27. cout << element << " ";
  28. element = element +6;
  29. }
  30.  
  31.  
  32.  
  33. }
  34.  
  35. void xd3()
  36. {
  37. int element=1;
  38. int n;
  39. cin >> n;
  40. for(int i=1;i<=n;i++)
  41. {
  42. if (i%2!=0)
  43. cout << element << " ";
  44. else
  45. cout << element * -1 << " ";
  46.  
  47.  
  48.  
  49.  
  50.  
  51. element = element *2;
  52. }
  53.  
  54.  
  55.  
  56. }
  57. void z1()
  58. {
  59. int i;
  60. cout<<"pkt A"<<endl;
  61. for (i =-4;i <=14;i=i+3)
  62. cout<<i<<" ";
  63. cout<<endl<<"pkt C"<<endl;
  64. int j;
  65. for (j =12;j>=-12;j=j-4)
  66. cout<<j<<" ";
  67. cout<<endl<<"pkt D"<<endl;
  68. int k;
  69. for (k=12;k>=1;k=k-3)
  70. cout<<k<<" ";
  71. if(k<3){
  72. k=0;
  73. }
  74. cout<<k<<" ";
  75.  
  76. cout<<endl<<"pkt B"<<endl;
  77. int a;
  78. for(a=1;a<11;a++){
  79. if(a%2!=0)
  80. cout<<a<<" ";
  81. else
  82. cout<<a*-1<<" ";
  83. }
  84. cout<<endl<<"pkt E"<<endl;
  85. cout<<"1"<<" ";
  86. int b;
  87. for(b=3;b<19;b=b+3){
  88. if(b%2!=0)
  89. cout<<b*-1<<" ";
  90. else
  91. cout<<b<<" ";
  92.  
  93. }
  94.  
  95. }
  96. int main()
  97. {
  98. xd3();
  99.  
  100. return 0;
  101. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement