View Code of Problem 56

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



}

Double click to view unformatted code.


Back to problem 56