###### tags: `python-TQC` # TQC+ 程式語言Python 202 倍數判斷 1. 題目說明: 請開啟PYD202.py檔案,依下列題意進行作答,判斷輸入值是否為3或5的倍數,使輸出值符合題意要求。作答完成請另存新檔為PYA202.py再進行評分。 2. 設計說明: 請使用選擇敘述撰寫一程式,讓使用者輸入一個正整數,然後判斷它是3或5的倍數,顯示【x is a multiple of 3.】或【x is a multiple of 5.】;若此數值同時為3與5的倍數,顯示【x is a multiple of 3 and 5.】;如此數值皆不屬於3或5的倍數,顯示【x is not a multiple of 3 or 5.】,將使用者輸入的數值代入x。 3. 輸入輸出: 輸入說明 一個正整數 輸出說明 判斷是否為3或者是5的倍數 ![](https://i.imgur.com/dG39vhF.png) ```python= n = eval(input()) if n%3 == 0 and n%5 == 0: print("{} is a multiple of 3 and 5.".format(n)) elif n%5 == 0: print("{} is a multiple of 5.".format(n)) elif n%3 == 0: print("{} is a multiple of 3.".format(n)) else: print("{} is not a multiple of 3 or 5.".format(n)) ```