Search:

Type: Posts; User: aussiemcgr

Search: Search took 0.08 seconds.

  1. Re: How to alternate plus and minus signs in java?

    Oh. That's a bit more complicated. You will want a double variable located outside of your for loop. Inside your if/else statement, you would want to add or subtract the value of:...
  2. Re: How to alternate plus and minus signs in java?

    Well, first of all, you want to take out where you add the plus symbol in your first print statement (the one where you print the numerator and the denominator). Second, your numerator doesn't...
  3. Re: How to alternate plus and minus signs in java?

    The easiest way? Use mod. An integer mod 2 will result in either 0 or 1 (depending on whether the number is odd or even). Then you just need an if statement where:

    if(someNumber % 2 == 0)
    ...
Results 1 to 3 of 3