--- tags: DICE C --- 5-6 時間計算 === > [name=CHAWTeam] [time=Jun 16, 2022] --- 目錄:[DICE C語言程式破解](https://hackmd.io/@CHAWTeam/DiceC) 上一篇:[5-5 三次溫度換算](https://hackmd.io/@CHAWTeam/DiceC-5-5) 下一篇:[5-7 自主學習](https://hackmd.io/@CHAWTeam/DiceC-5-7) --- 題目 --- ```! 寫一個程式,計算包粽子所花的時間, 小區包1個粽子需要1分15秒,連續包X個粽子共需要幾分幾秒? 輸入範例: 3 輸出範例: 3個粽子共需要3分45秒 ``` 程式碼 --- ```c= #include <stdio.h> int main() { int a, m, s; //設 a 為粽子個數、 m 為分鐘、 s 為秒鐘 scanf("%d", &a); m = 75*a/60; // 75秒/個 * 個數 ,再換算成分鐘數 s = 75*a-60*m; // 75秒/個 * 個數 ,再換算成秒鐘數 printf("%d個粽子共需要%d分%d秒", a, m, s); return 0; } ``` 輸出 --- ```! 3 3個粽子共需要3分45秒 ``` --- [查看我們在HackMD上的所有筆記](https://hackmd.io/@CHAWTeam) 目錄:[DICE C語言程式破解](https://hackmd.io/@CHAWTeam/DiceC) 上一篇:[5-5 三次溫度換算](https://hackmd.io/@CHAWTeam/DiceC-5-5) 下一篇:[5-7 自主學習](https://hackmd.io/@CHAWTeam/DiceC-5-7) --- {%hackmd Iiu5mOixR7yWkPHKCkabBg %} <iframe class="LikeCoin" height="235" src="https://button.like.co/in/embed/chawteam/button?referrer=https://hackmd.io/@CHAWTeam/DiceC-5-6" width="100%"></iframe> --- {%hackmd i1nMRrZcTFmTvoF897K9zg %}
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up