Advertisement
Guest User

Milisegundos a HH:MM:SS

a guest
Apr 20th, 2013
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.32 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. void main (void)
  4. {
  5.   unsigned long ms;
  6.   int n;
  7.  
  8.   n=scanf("%lu",&ms);
  9.  
  10.   if (n==1)
  11.   {
  12.     ms+=999;   // Esta línea redondea hacia arriba 1 segundo
  13.     ms/=1000;  // Desechamos los milisegundos
  14.     printf("%lu:%02lu:%02lu",ms/3600,(ms%3600)/60,ms%60);
  15.   }
  16.   else fprintf(stderr,"Error\n");
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement