Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <fcntl.h>
- #include <unistd.h>
- #include <sys/wait.h>
- #include <sys/types.h>
- int
- main(void)
- {
- int n;
- scanf("%d", &n);
- for(int i = 1; i <= n; i++) {
- printf("%d\n", i);
- fflush(stdout);
- if(!fork()) {
- } else {
- break;
- }
- }
- wait(NULL);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement