Search:

Type: Posts; User: Delstateprogramer

Search: Search took 0.10 seconds.

  1. Replies
    21
    Views
    3,070

    Re: New Recursion problem need lil help

    lol the code works and that all that matters
  2. Replies
    21
    Views
    3,070

    Re: New Recursion problem need lil help

    Thank you for your help everyone i figured the problem out heres the code i used


    public static int addDigits(int number)
    {
    if(number<10)
    {
    sum=number+sum;
    }
    else
  3. Replies
    21
    Views
    3,070

    Re: New Recursion problem need lil help

    Tried this code and it didnt work


    if(number<10)
    {
    return number;
    }
    else
    {
    return (number%10)+((addDigits(number/10)));
  4. Replies
    21
    Views
    3,070

    Re: New Recursion problem need lil help

    Ok thx ill try that out
  5. Replies
    21
    Views
    3,070

    Re: New Recursion problem need lil help

    how do i save the prior digits to add them up at the end becuz here they keep changing and are not saved so they cant be added at the end
  6. Replies
    21
    Views
    3,070

    Re: New Recursion problem need lil help

    The user should be able to enter any integer and the program should output the sum of the digits in the integer.
  7. Replies
    21
    Views
    3,070

    Re: New Recursion problem need lil help

    I didnt intend for it to be a number 1 through 99. It would not matter what the user put in. and yes it would add the digits in an integer. Heres an example.

    If the user entered the integer 223...
  8. Replies
    21
    Views
    3,070

    Re: New Recursion problem need lil help

    thats the new code but yea its a logical error in there somewhere
  9. Replies
    21
    Views
    3,070

    Re: New Recursion problem need lil help

    public class AddEmUp {

    /**
    * @param args the command line arguments
    */
    public static void main(String[] args) {
    System.out.println("Enter an integer:");
    ...
  10. Replies
    21
    Views
    3,070

    Re: New Recursion problem need lil help

    yes thats exactly it and I fear i thought i got it but i didnt still need some help lol
  11. Replies
    21
    Views
    3,070

    Re: New Recursion problem need lil help

    Nvm all i got it
  12. Replies
    21
    Views
    3,070

    Re: New Recursion problem need lil help

    Changed my mind not gonna use an array, ive decided to do something like this but its not really working and i kno why but i dnt know how to change itm


    while(number>10)
    {
    digit=number%10;
    sum...
  13. Replies
    21
    Views
    3,070

    New Recursion problem need lil help

    this program is supposed to add up the integers in a number entered by a user and print out the sum. i got the easy part down.


    if(number<10)
    {
    sum=number;
    }


    for the next part i was...
Results 1 to 13 of 14