mirror of
https://bitbucket.org/Mattrixwv/projecteulerjava.git
synced 2025-12-06 17:13:58 -05:00
Fixed typo
This commit is contained in:
@@ -51,7 +51,7 @@ public class Problem5 extends Problem{
|
|||||||
|
|
||||||
//Start at 20 because it must at least be divisible by 20. Increment by 2 because it must be an even number to be divisible by 2
|
//Start at 20 because it must at least be divisible by 20. Increment by 2 because it must be an even number to be divisible by 2
|
||||||
boolean numFound = false; //A flag for finding the divisible number
|
boolean numFound = false; //A flag for finding the divisible number
|
||||||
int currentNum = 20; //The number that it are currently checking against
|
int currentNum = 20; //The number that it is currently checking against
|
||||||
while((currentNum > 0) && (!numFound)){
|
while((currentNum > 0) && (!numFound)){
|
||||||
//Start by assuming you found the number (because we throw a flag if we didn't find it)
|
//Start by assuming you found the number (because we throw a flag if we didn't find it)
|
||||||
numFound = true;
|
numFound = true;
|
||||||
@@ -90,7 +90,7 @@ public class Problem5 extends Problem{
|
|||||||
if(!solved){
|
if(!solved){
|
||||||
throw new Unsolved();
|
throw new Unsolved();
|
||||||
}
|
}
|
||||||
return String.format("The smallest positive number evenly divisible by all numbers 1-20 is " + smallestNum);
|
return String.format("The smallest positive number evenly divisible by all numbers 1-20 is %d", smallestNum);
|
||||||
}
|
}
|
||||||
//Returns the requested number
|
//Returns the requested number
|
||||||
public int getNumber(){
|
public int getNumber(){
|
||||||
@@ -103,6 +103,6 @@ public class Problem5 extends Problem{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Results:
|
/* Results:
|
||||||
The smallest positive number evenly divisibly by all number 1-20 is 232792560
|
The smallest positive number evenly divisible by all numbers 1-20 is 232792560
|
||||||
It took an average of 280.352 milliseconds to run this problem through 100 iterations
|
It took an average of 213.942 milliseconds to run this problem through 100 iterations
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user