View Code of Problem 56

#include "stdio.h"

void main()
{
	int a,b,c;
	int x,y,z;
	int sum1,sum2;
	int t;
	scanf("%d%d%d%d%d%d",&a,&b,&c,&x,&y,&z);
	sum1=a*60*60+b*60+c;
	sum2=x*60*60+y*60+z;
	t=sum1-sum2;
	if(t<0)
		t=-t;
	a=t/3600;
	t=t%3600;
	b=t/60;
	t=t%60;
	c=t;
	printf("%d:%02d:%02d",a,b,c);
}

Double click to view unformatted code.


Back to problem 56