Advertisement
Guest User

Untitled

a guest
Aug 16th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.02 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <sys/param.h>
  4. int sec;
  5. int min;
  6. int hour;
  7. int main() {
  8. seco:
  9. for(sec = 0; sec < 60; sec++) {
  10.         system("clear");
  11.         if(sec < 10) {
  12.                 printf("%d:%d:0%d\n", hour, min, sec); }
  13.         else {
  14.                 printf("%d:%d:%d\n", hour, min,  sec); }
  15.                         sleep(1);
  16. if (hour > 24) {
  17. hour = 0; }
  18. if (min > 60) {
  19. hour++;
  20. min = 0; }//fi
  21. }//rof
  22.  
  23. if (sec > 59 ) {
  24. min++;
  25. goto seco;  }//fi
  26. }//niam
  27. [lucer@archie c]$ cat neoclock.c
  28. #include <stdio.h>
  29. #include <stdlib.h>
  30. #include <sys/param.h>
  31. int sec;
  32. int min;
  33. int hour;
  34. int main() {
  35. seco:
  36. for(sec = 0; sec < 60; sec++) {
  37.         system("clear");
  38.         if(sec < 10) {
  39.                 printf("%d:%d:0%d\n", hour, min, sec); }
  40.         else {
  41.                 printf("%d:%d:%d\n", hour, min,  sec); }
  42.                         sleep(1);
  43. if (hour > 24) {
  44. hour = 0; }
  45. if (min > 60) {
  46. hour++;
  47. min = 0; }//fi
  48. }//rof
  49.  
  50. if (sec > 59 ) {
  51. min++;
  52. goto seco;  }//fi
  53. }//niam
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement