Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- 1. Seconds Clock
- Hey, do you think you could help me? I think my clock is broken. It used to show the time in hours, minutes, and seconds, but now it only shows it in seconds. I don't have enough money to buy a new one so I figured you could help me out with this. Help me convert the time in my clock to hours, minutes, and seconds. Thanks! I owe you one.
- Inputs
- 1. Time in seconds
- */
- #include <stdio.h>
- int main (void){
- int time, sec, min, hr;
- printf("Enter the time (seconds): ");
- scanf("%d", &time);
- hr = time / 3600;
- time = time % 3600;
- min = time / 60;
- sec = time % 60;
- printf("%d hr %d min %d sec", hr, min, sec);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement