import javax.swing.*;
public class NestedLoop
{
public static void main(String args[])
{
for(int x=0;x< 5;x++)
{
for(int y=0;y<=x;y++)
{
System.out.print("*");
}// end innerloop
System.out.println("");

}//end outerloop
System.out.println();
}//end main
}//end class

Recommended Answers

All 2 Replies

You forget something....................

@miltondollar- what are you trying to achieve? According to your program you are trying to print "*" in a particular fashion and you are importing the swing package?????

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.