fork download
  1. #include <stdio.h>
  2. #include <signal.h>
  3. #include <time.h>
  4. #include <unistd.h>
  5.  
  6. int n=0;
  7.  
  8. void beep(int sig)
  9. {
  10. printf("%d x %d = %d\n", n/8+2, n%8+2, (n/8+2)*(n%8+2));
  11. n++;
  12. if (n<64) { alarm(1); } /* rearm alarm */
  13. }
  14.  
  15. int main(void)
  16. {
  17. signal(SIGALRM, beep);
  18. alarm(1);
  19. printf("Press ENTER to stop the program.\n");
  20.  
  21. return 0;
  22. }
  23.  
Success #stdin #stdout 0s 4472KB
stdin
Standard input is empty
stdout
Press ENTER to stop the program.