Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <fcntl.h>
  4. #include <unistd.h>
  5. #include <sys/wait.h>
  6. #include <sys/types.h>
  7. int
  8. main(void)
  9. {
  10. int n;
  11. scanf("%d", &n);
  12. for(int i = 1; i <= n; i++) {
  13. printf("%d", i);
  14. fflush(stdout);
  15. if(fork()) {
  16. wait(NULL);
  17. return 0;
  18. }
  19. }
  20. printf("\n");
  21. return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement