In: Computer Science
Write the algorithm of program that evaluates the series 5-10+7+15+920+11+25+… up to x terms, where the value of x is taken as input from the user. For example, the sum of the given series up to 3 terms should give 2 as output (5-10+7=2), similarly, the sum of this series up to 4 terms should give 17 as output (5-10+7+15=17),
Write this in psuedocode
Pseudocode for the series 5-10+7+15+9+20+11+25+…
IF i==1 AND i!=x //(5- display
OUTPUT '('+START1+'-'
SUM=SUM+START1
START1=START1+2
ELSE IF i==1 //Display (5
OUTPUT '('+START1
SUM=SUM+START1
ELSE IF i==2 //Display(5-2
OUTPUT START2+'+'
SUM=SUM-START2
ELSE IF i==x AND i%2==0 //Last display
OUTPUT 'START2
SUM=SUM+START2
ELSE IF i==x AND i%2!=0 //Last display
OUTPUT START1
SUM=SUM+START1
ELSE //Otherwise
IF i%2==0
OUTPUT START2+'+'
SUM=SUM+START2
STARt2=START2+5
ELSE
OUTPUT START1+'+'
SUM=SUM+START1
STARt1=START1+2
--------------------------------------------------------------------------------------------------------------------------------------
Note:-
I assume the given series 920 means 9+20