Java Blog

 
 
 
 public class JAVA_029
 {

    public static void 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);
    }
 }

 
 
Didn't find what you were looking for? Find more on Program to show the use of Do-While Loop