Files
SCR.3.1/TP4/Ex1:/rebours.c

20 lines
343 B
C
Raw Normal View History

2025-10-02 15:09:43 +02:00
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char* argv[])
{
assert(argc == 2);
int value = strtol(argv[1], NULL, 0);
pid_t p = getpid();
printf("%d: debut\n",p);
for(int i = value; i>0; i--){
printf("%d: %d\n",p,i);
sleep(1);
}
printf("%d: fin\n",p);
return EXIT_SUCCESS;
}