Wednesday, January 8, 2014

Simple Pattern Printing Using BlueJ



Print the following pattern:

***_***
***_***
***_***
***_***
***_***


 class A
{
int i,j;
public void show()
{
for(i=0;i< 5;i++)
{
for(j=0;j< 7;j++)
{
 if(j==3)
 System.out.print("_");
else
System.out.print("*");
}
System.out.println();
}
}
public static void main(String args[]) throws Exception
{
A ob=new A();
ob.show();
}
}


No comments:

Post a Comment

Subscribe via email

Enter your email address:

Delivered by FeedBurner