View Code of Problem 56

#include<stdio.h>
#include<math.h>
int main()
{
	int s1,s2,f1,f2,m1,m2,t,t1,t2;
	scanf("%d:%d:%d",&s1,&f1,&m1);
	scanf("%d:%d:%d",&s2,&f2,&m2);
	t1=s1*3600+f1*60+m1;
	t2=s2*3600+f2*60+m2;
	t=fabs(t1-t2);
	s1=t/3600;
	f1=t%3600/60;
	m1=t%3600%60;
	printf("%d:%02d:%02d",s1,f1,m1);
	return 0; 
}

Double click to view unformatted code.


Back to problem 56