Logo 
Search:

Java Articles

Submit Article
Home » Articles » Java » Homework HelpRSS Feeds

Program to show the use of Do-While Loop

Posted By: Colleen Burton     Category: Java     Views: 3317

A Java Program to show the use of Do-While Loop.

Code for Program to show the use of Do-While Loop in Java

publicclass JAVA_029
 {

    publicstaticvoid main(String[] args)
    {
       int limit=20;
       int sum=0;
       int i=1;
 
       do 
       {
          sum+=i;
          i++;
       }
       while(i<=limit);

       System.out.println("Sum of first 20 integers = " + sum);
    }
 }
  
Share: 


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

Colleen Burton
Colleen Burton author of Program to show the use of Do-While Loop is from St Louis , United States. Colleen Burton says

 
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!