Q. Write a program that takes an array S as an argument and add all the odd values and display the sum.
Answer :-
s = eval (input("Enter a list of number :- "))
sum = 0
for i in s :
if i% 2 != 0 :
sum += i
print("Sum of odd number :-", sum)
Output :-
Enter a list of number :- [1,2,3,4,5,6,7,8,9]
Sum of odd number :- 25
>>>
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )