A Java Program to show the use of Break Statement.
publicclass JAVA_033 { publicstaticvoid main(String[] args) { int nValues=50; boolean isPrime=true; System.out.println("The Prime Numbers from 1 to 50 are : "); for(int i=1;i<=nValues;i++) { isPrime=true; for(int j=2;j<i;j++) { if((i%j)==0) { isPrime=false; break; } } if(isPrime) System.out.println(i); } } }