In this program we will display a pattern using any particular digit, say 5. The pattern would look like:
55555
55
55
55
55555
class Pat
{
int i,j,k,x=5;
public void show()
{
for(i=0;i< 5;i++)
{
if(i==0 || i==4)
k=4;
else
k=1;
for(j=0;j<=k;j++)
System.out.print(x);
System.out.println();
}
public static void main(String args[])
{
Pat ob=new Pat();
ob.show();
}
}
Related Post: BlueJ Programs On Pattern
No comments:
Post a Comment