Results 1 to 2 of 2
  1. #1
    davisater's Avatar
    Join Date
    Oct 2009
    Gender
    male
    Location
    I live in Singapore
    Posts
    25
    Reputation
    10
    Thanks
    3
    My Mood
    Tired

    Dear god help me (java)

    thanks got it working
    Last edited by davisater; 05-27-2011 at 03:04 AM.

  2. #2
    freedompeace's Avatar
    Join Date
    Jul 2010
    Gender
    female
    Posts
    3,033
    Reputation
    340
    Thanks
    2,792
    My Mood
    Sad
    1. You are resetting total to 0 every time you iterate through the loop
    2. total is of type int. This means it only stores integers, not 0.5. Dividing total by something will result in truncation, not rounding. In other words, 0.99999999 will be truncated to 0.
    3. I really can't be stuffed trying to decrypt weirdly formatted code, so I'll stop here.