Sunday, February 24, 2013

Sample While Loop 2


public class act2 {

    public static void main(String[] args) {
               
       
        StringBuffer a = new StringBuffer("AB");
       
        int i=2;
        while( i<=6 )
        {
           
            System.out.print(a);
           
            int j=i;
            while( j<=i+2 )
            {
                System.out.print(a);
                a.reverse();
                               
                j++;
               
            }
            i++;
            System.out.println();
        }
       
           
       
    }

}

No comments:

Post a Comment