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.
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.
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.
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?
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!
your Result 232792560%11 is 0 is correct.
What you exactly want. and What is wrong with you code?
can you explain clearly?