fork(1) download
  1. #include<stdio.h>
  2. int main ()
  3. {
  4. void t(int,char,char,char);
  5. t(3,'A','B','C');
  6. return 0;
  7. }
  8. void t(int n,char A, char B, char C)
  9. {
  10. if(n>0)
  11. {
  12. t(n-1,A,C,B);
  13. printf("move %c to %c\n",A, C);
  14. t(n-1,B,A,C);
  15. }
  16. }
Success #stdin #stdout 0.01s 115456KB
stdin
Standard input is empty
stdout
move A to C
move A to B
move C to B
move A to C
move B to A
move B to C
move A to C