View Code of Problem 56

#include<string.h>
#include<math.h>
#include<stdio.h>
#include<ctype.h>
int main()
{
	int h1,h2,m1,m2,s1,s2,a,b,d;
	scanf("%d:%d:%d",&h1,&m1,&s1);
	scanf("%d:%d:%d",&h2,&m2,&s2);
	a=h1*3600+m1*60+s1;
	b=h2*3600+m2*60+s2;
	d=b-a;
	if(d<0) d=-d;
	printf("%d:%02d:%02d",d/3600,d%3600/60,d%60) ;
	return 0;
 } 

Double click to view unformatted code.


Back to problem 56