write a program to find sum of even numbers and odd numbers upto n numbers IN PYTHON.
Answers
Answered by
1
Answer:
input(n)
sumodd =0
sumeven =0
for i in range(1,n+1):
if(i%2 != 0):
sumodd = sumodd+1
else:
sumeven = sumeven+1
print(sumodd)
print(" ")
print(sumeven)
Explanation:
We calculate this by using a for loop modulus operation with 2.
Similar questions