-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path02code.pyt
More file actions
34 lines (26 loc) · 952 Bytes
/
02code.pyt
File metadata and controls
34 lines (26 loc) · 952 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
while True:
sst = input("--Enter start to begin and exit to terminate: ").lower()
if sst == 'start':
try:
n = int(input("How many numbers do you want to enter: "))
sum5 = 0
sum7 = 0
sum11 = 0
for num in range(n):
num = int(input("Enter the number: "))
if num % 5 == 0:
sum5 += num
if num % 7 == 0:
sum7 += num
if num % 11 == 0:
sum11 += num
print(f"Sum of multiples of 5 = {sum5}")
print(f"Sum of multiples of 7 = {sum7}")
print(f"Sum of multiples of 11 = {sum11}")
except ValueError:
print("Enter valid integer values only!")
elif sst == 'exit':
print("-----------Terminated-----------------")
break
else:
print("Invalid input! Type 'start' or 'exit'.")