Monday, 5 September 2011

Nested Loop - to print a triangle pattern of star in c++


public class NestedLoop {
    public static void main(String[] args) {
        int i,j;
        for(i=0;i<10;i++){
            for(j=0;j<i;j++){
                System.out.print("*");
            }
            System.out.println();
        }
    }

}

No comments:

Post a Comment

Note: only a member of this blog may post a comment.