Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //compiler avec ... gcc -o heures heures.c
- #include <stdio.h>
- #include <stdlib.h>
- #include <unistd.h>
- int main (){
- int h,m,s;
- printf ("saisir les 3 variables ");
- scanf (" %d %d %d",&h,&m,&s);
- printf ("setup heure= %d ,min=%d ,sec=%d \n",h,m,s);
- while (1){ //Boucle test 1 sec
- if (s<59){s++;}
- else {s=0;m++;}
- if (m>59){m=0;h++;}
- if (h>23 ){h=0;}
- printf ("%d : %d : %d\n",h,m,s);
- sleep(1);//1 sec. retard
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement