HristoBaychev

8secInYears

Oct 5th, 2021 (edited)
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.67 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. int main() {
  5.  
  6. signed short int years = 1;
  7.  
  8. const unsigned short int daysInYear = 365;
  9. signed short int days = 0;
  10.  
  11.  
  12. const int daysInHours = 24;
  13. unsigned int totalHoursPerYear = 0;
  14.  
  15. const int minPerHour = 60;
  16. unsigned short int totalHour = 0;
  17.  
  18. const int totalSecPerHour = 60;
  19. unsigned int totalSec = 0;
  20.  
  21.  
  22. days =  years * daysInYear;
  23.  
  24. totalHoursPerYear = days * daysInHours;
  25.  
  26. totalHour = totalHoursPerYear * minPerHour;
  27.  
  28. totalSec = totalHour * totalSecPerHour;
  29.  
  30. printf("days : %d\n", days);
  31. printf("hours : %d\n", totalHoursPerYear);
  32. printf("mins : %d\n", totalHour);
  33. printf("secs : %d\n", totalSec);
  34.  
  35.  
  36. return 0;
  37. }
Add Comment
Please, Sign In to add comment