課程
/后端開發(fā)
/C
/C語言入門
求解
2016-10-13
源自:C語言入門 1-4
正在回答
每一行與圖照應
#include<stdio.h>
int main()
{
? ? int w;
? ? double s;
? ? scanf("%d",&w);
? ? if(w>0&&w<5)
? ? ? ? s=3;
? ? ?else if(w>5&&w<=10)
? ? ? ? s=3+3.5*(w-5);
? ? ? ? else if(w>10&&w<=20)
? ? ? ? ? ? s=20.5+(w-10)*4;
? ? ? ? else if(w>20&&w<=30)
? ? ? ? ? ? s=60.5+(w-20)*4.5;
? ? ? ? else if(w>30&&w<=50)
? ? ? ? ? ? s=105.5+(w-30)*5;
? ? ? ? else if(w>50)
? ? ? ? ? ? error;
? ? ? ? printf("%d",w);
? ? ? ? return 0;
}
舉報
C語言入門視頻教程,帶你進入編程世界的必修課-C語言
2 回答程序代碼不理解
2 回答編寫程序求解
3 回答代碼編寫求解
2 回答代碼問題求解
2 回答求解代碼錯誤
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2016-10-13
每一行與圖照應
2016-10-13
#include<stdio.h>
int main()
{
? ? int w;
? ? double s;
? ? scanf("%d",&w);
? ? if(w>0&&w<5)
? ? ? ? s=3;
? ? ?else if(w>5&&w<=10)
? ? ? ? s=3+3.5*(w-5);
? ? ? ? else if(w>10&&w<=20)
? ? ? ? ? ? s=20.5+(w-10)*4;
? ? ? ? else if(w>20&&w<=30)
? ? ? ? ? ? s=60.5+(w-20)*4.5;
? ? ? ? else if(w>30&&w<=50)
? ? ? ? ? ? s=105.5+(w-30)*5;
? ? ? ? else if(w>50)
? ? ? ? ? ? error;
? ? ? ? printf("%d",w);
? ? ? ? return 0;
}