㈠ C語言編程設計,分段計算乘坐地鐵票價,速度速度~
#include<stdio.h>main(){doublekm;intprice=0;scanf("%lf",&km);if(km>=0&&km<=6){price=3;}elseif(km>6&&km<=16){price=4;}if(km>16&&km<=26){price=5;}if(km>26){price=6;}printf("%d",price);}