Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sys/types.h>
- #include <unistd.h>
- #include <stdio.h>
- #include <stdlib.h>
- int main(int argc, char **argv){
- if(argc != 2){
- printf("No se ha llamado al programa de forma correcta: <path> <int>");
- exit(-1);
- }
- int n = strtol(argv[1], 0, 10);
- pid_t child = fork();
- if(child == 0){
- printf(n % 2 ? "%d es impar\n" : "%d es par\n", n);
- } else {
- printf(n % 4 ? "%d no es múltiplo de 4\n" : "4|%d\n", n); }
- }
Advertisement
Add Comment
Please, Sign In to add comment