#include <stdio.h>
struct time {
int hours;
int minutes;
int seconds;
};
int main() {
struct time t1, t2, diff;
printf("Enter the first time (hh:mm:ss): ");
scanf("%d:%d:%d", &t1.hours, &t1.minutes, &t1.seconds);
printf("Enter the second time (hh:mm:ss): ");
scanf("%d:%d:%d", &t2.hours, &t2.minutes, &t2.seconds);
// Calculate the difference between the two times
if (t2.seconds > t1.seconds) {
t1.minutes--;
t1.seconds += 60;
}
diff.seconds = t1.seconds - t2.seconds;
if (t2.minutes > t1.minutes) {
t1.hours--;
t1.minutes += 60;
}
diff.minutes = t1.minutes - t2.minutes;
diff.hours = t1.hours - t2.hours;
printf("\nTime Difference: %d:%d:%d - %d:%d:%d = %d:%d:%d\n", t1.hours, t1.minutes, t1.seconds, t2.hours, t2.minutes, t2.seconds, diff.hours, diff.minutes, diff.seconds);
return 0;
}