0

1-2+3-4+5.........n series program

please tell me the how to make this program

13th Jun 2018, 4:24 AM
Vishu's Future
Vishu's Future - avatar
1 Answer
+ 6
I have made a program for you. It has a simple logic. Declare a variable set to 0. Make a for loop till the number you want. If i is odd to add it to num and if even subtract it from num. Here an example in Java. https://code.sololearn.com/c84yBFi1FQXP/#java
13th Jun 2018, 4:37 AM
Akash Pal
Akash Pal - avatar