Logo 
Search:

Java Articles

Submit Article
Home » Articles » Java » Homework HelpRSS Feeds

Program to show the use of Break Statement

Posted By: Deloris Harris     Category: Java     Views: 1549

A Java Program to show the use of Break Statement.

Code for Program to show the use of Break Statement in Java

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);
       }
    }
 }
  
Share: 


Didn't find what you were looking for? Find more on Program to show the use of Break Statement Or get search suggestion and latest updates.

Deloris Harris
Deloris Harris author of Program to show the use of Break Statement is from Santa Barbara, United States.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!