Showing posts with label Java - LOOP. Show all posts
Showing posts with label Java - LOOP. Show all posts

Wednesday, April 1, 2015

java-Do while

 
public class DoWhile {
 
    public static void main(String[] args) {
        int coun=0;
        do{
            coun++;
            System.out.println(coun);
            
        }while(coun<=10);
 
    }
 
}

Inhance Loop

 
public class EnhanceLoop {
    public static void main(String[] args) {
        int a[]={5,2,3,5};
        int total =0;
        for(int x:a)
        {
            total+=x;
        }
        System.out.println(total);
    }
 
}