
-----------------------------------
Caceres
Tue Jul 04, 2006 5:42 pm

Noobie Needs Help
-----------------------------------
I can't get this program to work. And I've SERIOUSLY been working on it for about 7 hours now. It's seriously getting to me. 
It's supposed to do:
if n = 3
Then it'll be: 3 + 4 + 5 +6 = 18. The sum of integers shuold be 18, but i can't get this to work with any of the numbers. Please help. :cry: 

/* This program's purpose is to read an integer value for n and then sums
the integers from n to 2*n if n is positive, or from 2*n to n if n is
negative. This program's code will be using only "for" loops. */

import TerminalIO.KeyboardReader;

public class ass26a {
   public static void main(String[] args) {
      KeyboardReader reader = new KeyboardReader();
      int n=0;
      int two_n=0;           
      
      System.out.println("This program will sum the integers from entered value to entered value * 2.");
      System.out.println("Enter an integer value (positive or negative):");
      n = reader.readInt();
      
      if(n>=0)     
      for(;n