0
1-2+3-4+5.........n series program
please tell me the how to make this program
1 Respuesta
+ 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