fork download
  1. #include <iostream>
  2. using namespace std;
  3. void helper(int n){
  4. if(n == 0)return;
  5. cout<<n<<"down "<<endl;
  6. helper(n-1);
  7. cout<<n<< "up "<<endl;
  8. }
  9. int main() {
  10. int n;
  11. cin>>n;
  12. helper(n);
  13. return 0;
  14. }
Success #stdin #stdout 0.01s 5312KB
stdin
5
stdout
5down  
4down  
3down  
2down  
1down  
1up  
2up  
3up  
4up  
5up