Jump to content

Ryan Sony

Member
  • Posts

    11
  • Joined

  • Last visited

Reputation Activity

  1. Funny
    Ryan Sony reacted to DXMember in [HELP] pls check my JAVA program for errors   
    lol...
    Since this is Java, your int temp and int n both have reference to the same memory pointer.
    And when you exit the following loop - both temp and n values are at 0 (or less)
     
    When you first assign temp value, try this instead.
    int temp = Integer.valueOf(n); Yes Java (and C#) are retarded like that... they are built to get rid of manual memory management and pointers, but then introduce shit like this for God knows what reason....
     
    good luck and have fun
     
    EDIT:
    umm... didn't read the OP careful enough, guess your problem is solved down below, but it's still okay to know about this stuff.
  2. Informative
    Ryan Sony reacted to colonel_mortis in [HELP] pls check my JAVA program for errors   
    Your problem is this loop
    while(temp>0){ //while loop to count number of digits and form multiple of 10 to do modulus division temp=temp%10; d=d*10; } //loop ends The modulo operator, %, returns the remainder when divided, so 5 % 10 = 5. This means that you have an infinite loop.
    To fix it, you need to use / rather than %, so it will divide by 10 each time (and it uses integer division since the arguments are integers, so it rounds down).
×