A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.
public class SmallestMultiple{
public static void main(String []args){
int divisor=20;
long i=1L;
Boolean found = false;
while(true)
{
i++;
for(int j=divisor;j>0;j--)
{
if((i % j) == 0)
{
if(j == 1)
{
System.out.println(" " + i + " ");
found = true;
break;
}
}
else
{
break;
}
}
if(found)
{
System.out.println("Found\n");
break;
}
}
}
}
/*
2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.
What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?
*/
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
else
{
break;
}
I do intentionally want to break out of the loop if I cannot evenly divide.
If you are experiencing a similar issue, please ask a related question
Join the community of 500,000 technology professionals and ask your questions.