###### tags: `python-TQC` # TQC+ 程式語言Python 403 倍數總和計算 1. 題目說明: 請開啟PYD403.py檔案,依下列題意進行作答,使輸出值符合題意要求。作答完成請另存新檔為PYA403.py再進行評分。 2. 設計說明: 請撰寫一程式,讓使用者輸入兩個正整數a、b(a<=b),輸出從a到b(包含a和b)之間4或9的倍數(一列輸出十個數字、欄寬為4、靠左對齊)以及倍數之個數、總和。 3. 輸入輸出: 輸入說明 兩個正整數a、b(a<=b) 輸出說明 格式化輸出兩個正整數之間4或9之倍數(包含a和b) 倍數個數 倍數總合  ```python= a = eval(input()) b = eval(input()) count = 0 tot = 0 for i in range(a,b+1): if i%4 == 0 or i%9 == 0: count += 1 tot += i print("{:<4}".format(i),end="") if count%10 == 0: print() print("\n{}".format(count)) print(tot) ```
×
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