回覆列表
  • 1 # fesla4443

    #include<stdio.h>#include<math.h>intmain(){longintnum;intindiv,ten,hundred,thousand,ten_thousand,place;printf("intputainterger(0~99999):");scanf("%ld",&num);if(num>9999)place=5;elseif(num>999)place=4;elseif(num>99)place=3;elseif(num>9)place=2;elseplace=1;printf("位數=%d\n",place);printf("每位數字為:");ten_thousand=num/10000;thousand=(int)(num-ten_thousand*10000)/1000;hundred=(int)(num-ten_thousand*10000-thousand*1000)/100;ten=(int)(num-ten_thousand*10000-thousand*1000-hundred*100)/10;indiv=(int)(num-ten_thousand*10000-thousand*1000-hundred*100-ten*10);printf("方向數字為\n:");switch(place){case5:printf("%d%d%d%d%d\n",indiv,ten,hundred,thousand,ten_thousand);break;case4:printf("%d%d%d%d\n",indiv,ten,hundred,thousand);break;case3:printf("%d%d%d\n",indiv,ten,hundred);break;case2:printf("%d%d\n",indiv,ten);break;case1:printf("%d\n",indiv);break;}}是這個樣子了,如果有錯,可能是我打錯了吧,基本是沒什麼錯誤的

  • 中秋節和大豐收的關聯?
  • 道之道非常道,非常道無間道,請問朋友們怎樣理解和解析這句話的寓意?