how do i alternate from positive int and negative int in a number sequence

I am doing an assignment for university and I have to print out the first ten numbers of a number sequence which is 1, 2, 0, 3, -1, 4, -2.... I have worked out the rest of the sequence which is where you alternate adding a positive number and then a negative one for example to go from 1 to 2 you add the number one and then to go from 2 to 0 you add the number -2. But I cant quite get my head around how to alternate...

Read More »

By: StackOverFlow - Thursday, 8 November

Related Posts