Computer Science, asked by kanupriya163, 3 months ago

write a Java program for class 9 to generate following series sum=1-2+3-4+5-----20​

Answers

Answered by pankajsaini22877
2

Answer:

-6+7-8+9-10+11-12+13-14+15-16+17-18+19

Explanation:

Hope it helps you.

Answered by sukhmanam
0

Explanation

using for loop is the best way and odd even reference can be done value of I odd means

sum - i

value of I even means

sum + I

and return the sum as final answer

Attachments:
Similar questions