Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main(){
- int pid = fork();
- if(pid == 0){ // le fils
- system("ls -1 | wc -l > /tmp/compte.data");
- } else{ // le pere
- int i = 1;
- float x = 0;
- while(i<=1000){
- if(i%2 == 1) x = x+1.0/i;
- else x = x-1.0/i;
- i++;
- }
- printf("La serie: %f\n",x);
- system("x=$(cat /tmp/compte.data); echo Le repertoire courant contient $x fichiers.");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement