Advertisement
SelinD

V93s3ex3

Apr 2nd, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. int v[100];
  4. int main()
  5. {
  6. int n,i,a,b;
  7. cin>>n;
  8. a=1;
  9. b=n;
  10. for(i=1;i<=n;i++)
  11. {
  12. if(i%2!=0)
  13. {
  14. v[i]=a;
  15. a++;
  16. }
  17. else {
  18. v[i]=b;
  19. b--;
  20. }
  21. }
  22. for(i=1;i<=n;i++) cout<<v[i]<<" ";
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement