Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: modulus question

  1. #1
    Junior Member
    Join Date
    Feb 2014
    Posts
    11
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default modulus question

    Modulus is killing me, is this right?

    x=12.3, y=14, z=5.2

    z=y%x++

    z=(14%12.3) +1
    z=(14/12.3=1.166) +1
    z= (Remainder is 1?) +1
    z= 2


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,149
    Thanks
    48
    Thanked 2,158 Times in 2,131 Posts

    Default Re: modulus question

    Can you make a small program with println()s for testing? Compile and execute it to see what happens.
    If you have questions about the output, copy and paste it here with your questions.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Member
    Join Date
    Jul 2013
    Location
    Europe
    Posts
    471
    Thanks
    0
    Thanked 90 Times in 75 Posts

    Default Re: modulus question

    You should also read up what the "++" operator does in java because from your example I take that you do not correctly understand it at the moment.

Similar Threads

  1. Replies: 1
    Last Post: November 4th, 2013, 04:38 AM
  2. BruceForce Method and Modulus HELP!
    By JAVAHELPP in forum What's Wrong With My Code?
    Replies: 3
    Last Post: March 13th, 2013, 03:38 AM
  3. Modulus with BigIntegers
    By JDreben in forum What's Wrong With My Code?
    Replies: 2
    Last Post: March 24th, 2012, 10:00 PM