View Code of Problem 56

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

int main()
{
    int a,b,c,e,f,g,i,j,cha,x,y,z;
    scanf("%d:%d:%d",&a,&b,&c);
    scanf("%d:%d:%d",&e,&f,&g);

    i=c+b*60+a*3600;
    j=g+f*60+e*3600;
    cha=fabs(j-i);
    z=cha%60;
    y=cha/60%60;
    x=cha/3600%24;
    printf("%2d:%02d:%02d\n",x,y,z);

}

Double click to view unformatted code.


Back to problem 56