View Code of Problem 56

#include <stdio.h>
#include <math.h>

int main(){
	int i,j,k,a,b,c,x,y,z;
	scanf("%d:%d:%d",&a,&b,&c);
	scanf("%d:%d:%d",&x,&y,&z);
	i=a*3600+b*60+c;
	j=x*3600+y*60+z;
	k=fabs(i-j);
	a=k/3600;
	b=k%3600/60;
	c=k%3600%60;
	printf("%d:%02d:%02d\n",a,b,c);
    return 0;
}

Double click to view unformatted code.


Back to problem 56