Given a list of integers, L, Write a program to calculate and display the sum of all the odd numbers in the list.
Thanked:
https://brainly.in/question/33596830?utm_source=android&utm_medium=share&utm_campaign=question
Answers
Answered by
5
Program:
Explanation:
- For loop will get the values from list in i.
- If statement checks if the number is odd and adds it in variable sum.
- Finally we print the sum.
Answered by
1
Answer:
i = 1
sum=0
n=int(input("enter the upper limit"))
while i <= n :
sum=sum+i
i = i + 2
print("sum =",sum)
Similar questions