用if语句把24小时制转换成12小时制

public class yunsuanfu {
    public static  void main(String[] arg){
        double t=2;
        int h=38;
        int m=100;
        int s=100;
    
        if(s>60){
            m=(s/60)+m;s=s%60;
        }
        if (m>60){
            h=(m/60)+h;m=m%60;
        }
        if(h>12){
         t=t+(0.5*(h/12));h=h%12;
        }
        System.out.println(t+"天"+h+"点"+m+"分"+s+"秒");
}
}
原文地址:https://www.cnblogs.com/php111/p/5013783.html