Write a code to find out the sum of the sequence 2 -4 6 -8 10 -12... While the last value will be determined from input. Use a loop to solve the problem.
1
Expert's answer
2021-08-26T18:32:20-0400
N = int(input("Enter the number of elements in series: "))
Sum = 0
s=""
for r in range(0,N):
u = (2*r+2)*((-1)**r)
if(u>0): s=s+"+"+str(u)
else: s = s+str(u)
Sum = Sum + u
print("Sum of series: ",s," = ",Sum)
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment