fork download
  1. #include <stdio.h>
  2. int forward(int n){
  3. if (n <= 3){
  4. printf("%d\n",n);
  5. forward(n+1);
  6. }
  7. }
  8. int back(int n){
  9. if (n >= 1){
  10. printf("%d\n",n);
  11. back(n-1);
  12. }
  13. }
  14. int main(){
  15. forward(1);
  16. back(3);
  17. }
Success #stdin #stdout 0s 5284KB
stdin
Standard input is empty
stdout
1
2
3
3
2
1