3x5w4rup

Clock

Apr 19th, 2014
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.54 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. #include<unistd.h>
  4.  
  5. int main()
  6. {
  7.     int hour=0,sec=0,min=0,day=0;
  8.     while(1)
  9.     {
  10.         if(sec==59)
  11.         {
  12.             min++;
  13.             sec=0;
  14.         }
  15.         if(min==59)
  16.         {
  17.             hour++;
  18.             min=0;
  19.         }
  20.         if(hour==24)
  21.         {
  22.             day++;
  23.             hour=0;
  24.         }
  25.         sec++;
  26.         printf("\n\n\n\t\t\t\tDIGITAL CLOCK\n\t\t\t\t  %d : %d : %d\n",hour,min,sec);
  27.         sleep(1);
  28.         system("clear");
  29.     }
  30.     return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment