2022年4月5日 星期二

UVa10929 - You can say 11 (Python)

 

while 1:
	try:
		num = int(input())
		if num == 0:
			break
		if num%11 == 0:
			print(f"{num} is a multiple of 11.")
		else:
			print(f"{num} is not a multiple of 11.")
	except:
		pass

1. 要對input的部分進行例外處理

2. 收到0時結束

0 comments:

張貼留言