Hello I’m new to programming and my teacher had given me this problem to solve and I got no clue in it and I needed extra help for it.
This is very easy.
You need
This program has 2 inputs namely x and n
- A for loop that iterate from 1 to n
You need an if statement
After taking inputs, initialize the sum to zero(s=0) for I in range(1, n+1) : if i%2==0: s -= xi (close the if statement) s += xi