Develop a python program to
accept ‘n’ numbers from user. Find sum of all odd numbers and product of all odd
numbers in entered list
Answers
Answered by
0
Answer:
n = int(input("Enter the number of elements in the list:"))
numbers = []
oddSum = 0
oddProduct = 1
print("Enter all",n,"numbers in the list")
for i in range(n):
n = int(input())
numbers.append(n)
if(numbers[i]%2 == 1):
oddSum += numbers[i]
oddProduct *= numbers[i]
print("The sum of all odd numbers in the list",oddSum)
print("The product of all odd numbers in the list",oddProduct)
Explanation:
Similar questions