View Code of Problem 56

#include <stdio.h>
#include <math.h>
void main(){
	int h,h1,h2,m,m1,m2,s,s1,s2,a1,a2,b;
	scanf("%d:%d:%d",&h1,&m1,&s1);
	scanf("%d:%d:%d",&h2,&m2,&s2);
	a1=h1*3600+m1*60+s1;
	a2=h2*3600+m2*60+s2;
	b=fabs(a1-a2);
	h=b/3600;
	m=b/60%60;
	s=b%60;
	printf("%d:%02d:%02d",h,m,s);

}

Double click to view unformatted code.


Back to problem 56