Advertisement
Dido09

C - Second Converter

May 24th, 2022
858
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.37 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.     int seconds, minutes, hours;
  6.  
  7.     printf("Enter the seconds: ");
  8.     scanf("%d", &seconds);
  9.  
  10.     hours = seconds / 3600;
  11.  
  12.     minutes = (seconds - (hours * 3600)) / 60;
  13.  
  14.     seconds = (seconds - (3600 * hours)- (minutes * 60));
  15.  
  16.     printf("Hours: %d, Minutes: %d, Seconds: %d", hours, minutes, seconds);
  17.  
  18.     return 0;
  19. }
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement