View Code of Problem 56

#include<stdio.h>
#include<math.h>
int main(void){
	int h,m,s;
	int hh,mm,ss;
	scanf("%d:%d:%d",&h,&m,&s);
	scanf("%d:%d:%d",&hh,&mm,&ss);
	int s1,s2,t;
	s1=h*3600+m*60+s;
	s2=hh*3600+mm*60+ss;
	t=fabs(s1-s2);
	printf("%d:%02d:%02d",t/3600,(t%3600)/60,(t%3600)%60);
}

Double click to view unformatted code.


Back to problem 56