View Code of Problem 56

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

int main()
{
    int h,m,s,h1,m1,s1,t,t1,time,h2,m2,s2;
    scanf("%d:%d:%d",&h,&m,&s);
    scanf("%d:%d:%d",&h1,&m1,&s1);
    t=h*3600+m*60+s;
    t1=h1*3600+m1*60+s1;
    time=fabs(t-t1);
    h2=time/3600;
    m2=(time%3600)/60;
    s2=time%60;
    printf("%d:%02d:%02d",h2,m2,s2);

}

Double click to view unformatted code.


Back to problem 56