118k views
0 votes
Sum = 2 + 4 + 6 + 8 + 10 + 12 + 14 + 16.... + N, the user has to enter the value of N and N should be an even number, if N was entered as an odd number you should print a message "Wrong Input!”, otherwise find the sum of the series.

User Moonstruck
by
8.1k points

1 Answer

3 votes

I am writing down the solution in python language.


sum = 0

N = int(input("Enter a number"))

if N%2==0:

sum = sum + N

else:

print("wrong input")


This is the solution of the problem i hope you get the idea.

Thanks

User Tomer Wolberg
by
7.8k points