Logo 
Search:

Java Articles

Submit Article
Home » Articles » Java » Homework HelpRSS Feeds

Program to show the use of For Loop

Posted By: Angelo Anderson     Category: Java     Views: 2328

A Java Program to show the use of For Loop.

Code for Program to show the use of For Loop in Java

publicclass JAVA_027
 {
    publicstaticvoid main(String[] args)
    {
       int limit=20;
       int sum=0;

       for(int i=1;i<=limit;i++)
          sum+=i;

       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 For Loop Or get search suggestion and latest updates.

Angelo Anderson
Angelo Anderson author of Program to show the use of For Loop is from Columbus, 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!