2 comments:

  1. num=int(raw_input("enter the number "))
    i=2
    s=0
    for num in range(1,num+1,2):
    t=pow(-1,i)
    s=s+num*t
    i=i+1
    print s

    ReplyDelete
  2. num=int(raw_input("enter the number "))
    i=2
    s=0
    r=1
    for num in range(1,num+1):
    t=pow(-1,i)
    s=s+r*t
    i=i+1
    r=r+2
    print s
    enter the number 5
    5

    ReplyDelete