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 4 of 4

Thread: BruceForce Method and Modulus HELP!

  1. #1
    Junior Member
    Join Date
    Mar 2013
    Posts
    11
    My Mood
    Worried
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default BruceForce Method and Modulus HELP!

    I was wondering how to take the modulus of every number from 11 through 20 getting a successful run of modulus values of zero for a particular number using a while loop. Thank you.


  2. #2
    Super Moderator curmudgeon's Avatar
    Join Date
    Aug 2012
    Posts
    1,130
    My Mood
    Cynical
    Thanks
    64
    Thanked 139 Times in 134 Posts

    Default Re: BruceForce Method and Modulus HELP!

    Yes this can be done (if I'm understanding you correctly). Why not give it a try and see what you get? Or if you've already done this, what is not working for you? What is wrong with your code?

  3. #3
    Junior Member
    Join Date
    Mar 2013
    Posts
    11
    My Mood
    Worried
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: BruceForce Method and Modulus HELP!

    I just need help getting started sir. Im not that familiar with while loops. Like i know how to do it individually doing one by one. But a while loop is the way to go.
    int i = number;
     
     
     
        int j = 11;
     
     
     
        int k = i % j;
        System.out.println(number + "%" + j + " is " + k);

    Result:
    232792560%11 is 0

    If you can get it going on the right path. I have to finish this before i go to bed. So anything would help! thanks

    --- Update ---

    I have to prove that taking the modulus of 232792560 from numbers 11-20 results in getting a zero using a while loop.

    --- Update ---

    So far but its wrong:
     
     
        int start = 11;
        int end_value = 20;
     
     
        while (start <= end_value)
        	start++;
     
       System.out.println(number % start);


    Result:
     
    0

    I need help!

  4. #4
    Member
    Join Date
    Feb 2013
    Posts
    45
    Thanks
    0
    Thanked 5 Times in 5 Posts

    Default Re: BruceForce Method and Modulus HELP!

    your Result 232792560%11 is 0 is correct.

    What you exactly want. and What is wrong with you code?
    can you explain clearly?
    Regards
    Android developer
    Trinay Technology Solutions
    http://www.trinaytech.com
    5705750475

Similar Threads

  1. Replies: 1
    Last Post: January 23rd, 2013, 07:29 AM
  2. [SOLVED] How to create a Java generic method, similar to a C++ template method?
    By Sharmeen in forum Object Oriented Programming
    Replies: 3
    Last Post: October 18th, 2012, 03:33 AM
  3. Modulus with BigIntegers
    By JDreben in forum What's Wrong With My Code?
    Replies: 2
    Last Post: March 24th, 2012, 11:00 PM
  4. Replies: 3
    Last Post: October 31st, 2011, 01:42 AM
  5. Can i call init() method in destroy method.?
    By muralidhar in forum Java Servlet
    Replies: 1
    Last Post: October 22nd, 2010, 12:18 PM