At Westonci.ca, we make it easy to get the answers you need from a community of informed and experienced contributors. Join our platform to get reliable answers to your questions from a knowledgeable community of experts. Explore comprehensive solutions to your questions from knowledgeable professionals across various fields on our platform.
Sagot :
Answer:
The program in Python is as follows:
n = int(input("Number of inputs: "))
total = 0; product = 1
for i in range(n):
num = int(input(": "))
if num%2 == 0:
total+=num
else:
product*=num
print("Sum of even: ",total)
print("Product of odd: ",product)
Explanation:
This prompts the user for the number of inputs, n
n = int(input("Number of inputs: "))
This initializes sum (total) to 0 and products to 1
total = 0; product = 1
This iterates through n
for i in range(n):
This gets the inputs
num = int(input(": "))
If input is even, calculate the sum
if num%2 == 0:
total+=num
If otherwise, calculate the product
else:
product*=num
Print the required outputs
print("Sum of even: ",total)
print("Product of odd: ",product)
Thanks for stopping by. We strive to provide the best answers for all your questions. See you again soon. We appreciate your visit. Our platform is always here to offer accurate and reliable answers. Return anytime. Thank you for trusting Westonci.ca. Don't forget to revisit us for more accurate and insightful answers.