View Code of Problem 56

#include<stdio.h>
#include<math.h>
int main()
{
	int h1,h2,m1,m2,s1,s2;
	scanf("%d:%d:%d",&h1,&m1,&s1); 
	scanf("%d:%d:%d",&h2,&m2,&s2);
	int time,time1,time2;
	//time =  fabs(h1-h2)*3600+fabs(m1-m2)*60+fabs(s1-s2);
	time1 = h1*3600+m1*60+s1;
	time2 = h2*3600+m2*60+s2;
	time = fabs(time1-time2);
	printf("%d:%02d:%02d\n",time/3600,time%3600/60,time%60);
	return 0;
}

Double click to view unformatted code.


Back to problem 56