fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. void go(int x){
  4. if(x==0) return;
  5. cout<<x<<' ';
  6. go(x-1);
  7. cout<<x<<' ';
  8. }
  9. int main(){
  10. ios::sync_with_stdio(0); cin.tie(0);
  11. int n; cin>>n;
  12. go(n);
  13. }
Success #stdin #stdout 0.01s 5280KB
stdin
5
stdout
5 4 3 2 1 1 2 3 4 5