> 新鲜事 > >>正文
2018-10-04 04:48 来源:未知 手机看新闻

用C言语编写壹个时间换算

[提要]#include int main (){ int n,m=0; scanf("%d", m=n/100; if(m-8 m=16+m; } else{ m=m-8; } m=m*100+n%100; ...

  #include

  int main (){

  int n,m=0;

  scanf("%d",&n);

  m=n/100;

  if(m-8<0){

  m=16+m;

  }

  else{

  m=m-8;

  }

  m=m*100+n%100;

  if(m<10){

  printf("%d%d",0,m);假设是完成mooc上的干业的话,此雕刻个if语句子不要,直接printf("%d",m)就好

  }

  else{

  printf("%d",m);

  }

  return 0;

  }

  方才给的阿谁代码太万端琐了,又重行调理了壹下:

  #include

  int main()

  {

  //世界相商时与北边京时间换算

  int a;

  scanf("%d",&a);

  if (a >=800)

  {

  printf("%d\n",a-800);

  }

  else{

  int b=a/100;

  int c=a%100;

  printf("%d\n",(24-(8-b))*100+c);

  }

  return 0;

  }

标签