--- tags: DICE Python --- 5-6 時間計算 === > [name=CHAWTeam] 目錄:[DICE Python程式破解](https://hackmd.io/@CHAWTeam/DicePy) 題目 --- ```! 寫一個程式,計算包粽子所花的時間, 小區包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 Python程式破解](https://hackmd.io/@CHAWTeam/DicePy) --- {%hackmd Iiu5mOixR7yWkPHKCkabBg %} <iframe class="LikeCoin" height="235" src="https://button.like.co/in/embed/chawteam/button?referrer=https://hackmd.io/@CHAWTeam/DicePy-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