Sunday, August 18, 2013

output is not getting displayed

output is not getting displayed

I am writing a simple java program to find the smallest number which is
divisible by all the numbers from 1 to 20.I have written the following
code,it is not giving any error but it is not giving any output.
package smallmultiple;
public class SmallMultiple {
public static void main(String[] args) {
int sml=0;
outerloop:
for(int i=40;i<100000;i++){
int j=1;
do{
if(i%j==0)
j++;
}while(j<21);
if(j==20){
sml=i;
break outerloop;
}
}
System.out.println(sml);
}
}
I am a newbie in java or say programming as a whole,so some mistake may
have crept in.Please help.

No comments:

Post a Comment