How To Print Sum Of The Series (1+2-3+4-5+6...................n )
#TO FIND THE SUM OF THE SERIES:- 1+2-3+4-5+6...............n
print('THE SERIES:- 1+2-3+4-5+6...............n')
n=int(input('\nEnter the range of the sum of the above series:-'))
x=1
for i in range(2,n+1):
x=x+((-1)**i)*i
print ('The Sum =',x)
Made By :-
Nilay Saraf
Comments
Post a Comment