Write a program to find the sum of odd numbers in first N natural numbers.
def is_odd(x): return x%2!=0 N=int(input('N= ')) s=0 for i in range(1,N+1): if is_odd(i): s+=i print('sum of odd numbers=', s)
Need a fast expert's response?
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Comments
Leave a comment