Advertisement
mahatma_xande

ex01lista06_extensao_v1

Aug 28th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.54 KB | None | 0 0
  1. /*
  2. It is a Timer! Enter the amount of hours (h), minutes (m) and seconds (s).
  3. */
  4.  
  5. #include <stdio.h>
  6. #include <windows.h>
  7.  
  8. int main(){
  9.  
  10.     int h, m, s;
  11.  
  12.     printf("Enter h, m, s: ");
  13.     scanf("%d %d %d", &h, &m, &s);
  14.  
  15.     while(m > -1){
  16.         system("cls");
  17.         printf("time left (h:m:s): %2d : %2d : %2d\n", h, m, s--);
  18.         Sleep(1000);
  19.  
  20.         if(s == -1){
  21.             s = 59;
  22.             m--;
  23.         }
  24.  
  25.         if(m == -1){
  26.             m = 59;
  27.             h--;
  28.         }
  29.     }
  30.  
  31.     printf("\nEnd!\n");
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement