fork download
  1. #include <stdio.h>
  2. int main( void) {
  3.  
  4. int totalSeconds=0;
  5. int d=0, h=0, m=0, s=0;
  6. int left = 0;
  7.  
  8. scanf(" %d s", &totalSeconds);
  9.  
  10. d = totalSeconds / (24*60*60);
  11. left = totalSeconds % (24*60*60); // the remainder from dividing 10
  12. h = left / (60*60); // and so on... 11 12
  13. printf(" %dd %dh %dm %ds\n", d, h ,m, s);
  14. }
Success #stdin #stdout 0s 2172KB
stdin
3458
stdout
 0d 0h 0m 0s