#include<stdio.h> main(){ int h1,m1,s1,h2,m2,s2; int t1,t2,t; int h,m,s; scanf("%02d:%02d:%02d",&h1,&m1,&s1); scanf("%02d:%02d:%02d",&h2,&m2,&s2); t1=h1*3600+m1*60+s1; t2=h2*3600+m2*60+s2; t=t1-t2; if(t<0){ t=t2-t1; } h=t/3600; m=t/60%60; s=t%60; printf("%d:%02d:%02d",h,m,s); } |
Double click to view unformatted code.