View Code of Problem 56

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

    }


Double click to view unformatted code.


Back to problem 56