Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Software Development
Programming
Programming Q&A
[Java] What is the smallest number from 1-20 that is divisible without a remainder%
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="percocet" data-source="post: 387286" data-attributes="member: 71898"><p>Hey,</p><p>I could ask this on stackexchange or just straight up find the answer online, but what fun would that be. Plus this is an opportunity to get to know everybody in the community.</p><p></p><p>So i've decided to try the projecteuler problems again (this time in java, not python) and am having trouble. Hopefully someone can check my logic</p><p></p><p>[CODE] public static int p003(){</p><p> int x = 1;</p><p> while (remainderChecker(x) == false){</p><p> x++;</p><p> }</p><p> </p><p> return x;</p><p> }</p><p></p><p> public static boolean remainderChecker(int x){</p><p> for (int i = 1; i<=20; i++){</p><p> if(x%i > 0){</p><p> return false;</p><p> }else</p><p> i++; </p><p> }</p><p> return true;</p><p> }</p><p> </p><p>}[/CODE]</p></blockquote><p></p>
[QUOTE="percocet, post: 387286, member: 71898"] Hey, I could ask this on stackexchange or just straight up find the answer online, but what fun would that be. Plus this is an opportunity to get to know everybody in the community. So i've decided to try the projecteuler problems again (this time in java, not python) and am having trouble. Hopefully someone can check my logic [CODE] public static int p003(){ int x = 1; while (remainderChecker(x) == false){ x++; } return x; } public static boolean remainderChecker(int x){ for (int i = 1; i<=20; i++){ if(x%i > 0){ return false; }else i++; } return true; } }[/CODE] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
Programming Q&A
[Java] What is the smallest number from 1-20 that is divisible without a remainder%
Top