Page 2 of 2 FirstFirst 12
Results 21 to 26 of 26
  1. #21
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default

    Java Code:
    26%6 = ???
    
    19  20  21  22  23  24   25   26
    13  14  15  16  17  18
    7   8   9   10  11  12
    1   2   3   4   5   6
    _   _   _   _   _   _
    1   2   3   4   5   6

    When you put 26 things into 6 stacks two things are left over. 26%6=2.

    is it 3 ?

    Are you seriously saying that you can put 6 things into 26 stacks and end up with 3 left over?

    Java Code:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
    1 2 3 4 5 6 7 8 9 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 
                      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6

    Forget decimal division and the number you get to the right of the decimal points. That has nothing to do with %.

    And be careful about the order of the operands. 26%6 and 6%26 are different things.

  2. #22
    batista11b5 is offline Member
    Join Date
    Oct 2010
    Posts
    23
    Rep Power
    0

    Default

    ok , I think i got it , so remainder is 9 ?

    And if 5 % 26 and the remainder is 10 ? is it right ?

    Thanks

  3. #23
    Join Date
    Apr 2010
    Posts
    22
    Rep Power
    0

    Default

    i am sorry i am new to this and shouldn't recommend anything

    but i think you have to solve this first using simple maths and then you can think in terms of a programming language.

    If you cant solve a question on paper, likely chances you wont be able to do it in a program.
    its simple multiplication..

    if u have 7 % 2 ==> you do 2*3 =6 therefore remainder is 1.

    if you have 11%5 ==>you just take the value of the right side (5) calculate it till you get below or equal the value on left side (11).

    so in this case 5 * 3 = 15 so we are going above the value of left side.. therefore its 5*2 = 10

    and remainder is again 1....

  4. #24
    joshdgreen's Avatar
    joshdgreen is offline Senior Member
    Join Date
    Oct 2010
    Location
    Colorado Springs, CO
    Posts
    212
    Rep Power
    4

    Default

    Quote Originally Posted by batista11b5 View Post
    ok , I think i got it , so remainder is 9 ?

    And if 5 % 26 and the remainder is 10 ? is it right ?

    Thanks

    ??? *facepalm*
    Sincerely, Joshua Green
    Please REP if I help :)

  5. #25
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,196
    Rep Power
    19

    Default

    This is beginning to look suspiciously like trolling. And if the OP's understanding is genuinely so flawed, s/he needs a math forum, not a Java forum.

    db

  6. #26
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,447
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by batista11b5 View Post
    ok , I think i got it , so remainder is 9 ?

    And if 5 % 26 and the remainder is 10 ? is it right ?
    On what planet? The Java modulo operator is defined as:

    Java Code:
    int javaMod(int a, int b {
       return a - b*(a/b);
    }
    where the '/' operator is integer division. Integer division is defined as:

    Java Code:
    int javaDiv(int a, int b) {
       return (a < b)?0:(1+javaDiv(a-b, b));
    }
    for a >= 0 and b > 0.

    kind regards,

    Jos

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Program in Java To calculate GCD of n numbers.?
    By ankitsinghal_89 in forum New To Java
    Replies: 4
    Last Post: 02-15-2011, 09:23 AM
  2. how to discard remainder on division?
    By RobertF in forum New To Java
    Replies: 9
    Last Post: 03-13-2009, 12:20 PM
  3. [SOLVED] Modulus/Remainder results
    By antgaudi in forum New To Java
    Replies: 9
    Last Post: 10-13-2008, 03:49 AM
  4. BigInteger remainder results in zero
    By perito in forum New To Java
    Replies: 1
    Last Post: 03-21-2008, 04:07 PM
  5. Calculate Tax in java
    By toby in forum New To Java
    Replies: 2
    Last Post: 07-30-2007, 09:03 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •