Results 1 to 2 of 2
  1. #1
    xnickx5x is offline Member
    Join Date
    Feb 2009
    Rep Power

    Default Need help with method

    I have to make a method that takes an int and adds all of the numbers below it together. For example if you input 5 you would get back 15 because 5+4+3+2+1=15. Im guessing that I have to create a for loop, but thats about as far as ive gotten. This is what i have so far....

    public int sumNumbers(int i){
    for(int x = i; x >0; x--)

  2. #2
    emceenugget is offline Senior Member
    Join Date
    Sep 2008
    Rep Power


    would this person happen to be your classmate? maybe you two should be friends:

    While loop

Similar Threads

  1. Replies: 2
    Last Post: 03-26-2010, 06:12 PM
  2. Replies: 1
    Last Post: 02-10-2009, 11:03 AM
  3. how to use a variable of one method in another method
    By lucasautomacao in forum New To Java
    Replies: 4
    Last Post: 10-29-2008, 03:21 PM
  4. Replies: 29
    Last Post: 09-25-2008, 07:55 PM
  5. cannot call private method from static method
    By jon80 in forum New To Java
    Replies: 3
    Last Post: 05-07-2008, 08:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts