# include // // Program 9.5, Stephen Kochan, Programming in C. // struct time { int hour; int minutes; int seconds; }; int main ( void ); struct time timeUpdate ( struct time now ); int main ( void ) { struct time currentTime, nextTime; printf ( "Enter the time (hh:mm:ss): " ); scanf ( "%i%i%i", ¤tTime.hour, ¤tTime.minutes, ¤tTime.seconds ); nextTime = timeUpdate ( currentTime ); printf ( "Updated time is %.2i:%.2i.%.2i\n", nextTime.hour, nextTime.minutes, nextTime.seconds ); return 0; } struct time timeUpdate ( struct time now ) { now.seconds = now.seconds + 1; if ( now.seconds == 60 ) { now.seconds = 0; now.minutes = now.minutes + 1; if ( now.minutes == 60 ) { now.minutes = 0; now.hour = now.hour + 1; if ( now.hour == 24 ) { now.hour = 0; } } } return now; }