#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Location
    Ireland
    Posts
    3
    Rep Power
    0

    Java Arithmetic Help (Student)


    Hi All,
    Got a question on a self assessment for college on Java arithmetic. They gave me the question and answer.. However, I get a different answer to what they're getting so wanted to know if any of you guys can see where or if I'm going wrong... It's one of those distance learning courses so I technically don't have a tutor to help....

    The Question is:
    Result = d % a * c + a % b + a

    a = 4
    b = 12
    c = 37
    d = 51

    The answer they gave me is 119. The answer I get is 109. HELP!!!
  2. #2
  3. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,724
    Rep Power
    348
    Post your code. I get 119 by copying and pasting the statements and adding a few ;s etc
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    74
    Rep Power
    19
    ((51 % 4) * 37) + (4 % 12) + 4
    = 3 * 37 + 4 + 4
    = 3 * 37 + 8
    = 111 + 8 = 119
  6. #4
  7. Java Junkie
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Feb 2004
    Location
    Mobile, Alabama
    Posts
    4,023
    Rep Power
    1285
    How do you get 109?

IMN logo majestic logo threadwatch logo seochat tools logo