Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- /*
- write a function that will determine how many hours, minutes,
- and seconds you can get from some number of seconds.
- */
- void timeSegments(int, int*, int*, int*);
- main(){
- int seconds, hours, minutes, secondsIn, secondsOut;
- secondsIn = 2345;
- timeSegments(secondsIn, &hours, &minutes, &secondsOut);
- printf("%d %d %d", hours, minutes, secondsOut);
- }
- void timeSegments(int secondsIn, int *pHours, int *pMinutes, int *secondsOut){
- *pHours = secondsIn / 3600;
- secondsIn %= 3600;
- *pMinutes = secondsIn / 60;
- secondsIn %= 60;
- *secondsOut = secondsIn;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement