Thursday, August 18, 2016

Pattern Of Any Particular Digit



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 PostBlueJ Programs On Pattern

No comments:

Post a Comment

Subscribe via email

Enter your email address:

Delivered by FeedBurner