代码实现

#include<stdio.h>

int main(){
    int c1,c2,ans;
    scanf("%d%d",&c1,&c2);
    ans=c2-c1;
    ans=(ans%100)>=50?(ans/100+1):ans/100;
    printf("%02d:%02d:%02d",ans/3600,(ans%3600)/60,(ans%60));
    return 0;
} 

错误记录

#include<stdio.h>

int main(){
    int c1,c2,ans;
    scanf("%d%d",&c1,&c2);
    ans=c2-c1;
    (ans%100)>=50?ans=(ans/100+1):ans=ans/100;                    //第一处
    printf("%d:%d:%d",ans/3600,(ans%3600)/60,(ans%60)));        //第二处
    return 0;
} 

//【第一处】左值出错,要加上括号

(ans%100)>=50?ans=(ans/100+1):ans=ans/100;

或者这样

ans=(ans%100)>=50?(ans/100+1):ans/100;

​ //【第二处】要求两个数字表示,因此输出格式需要用%02d 不足两位时用0填充