Tuesday, November 20, 2012

Pattern Programs In BlueJ Java

Two programs on pattern are given below. The programs are developed using java.

The first pattern is:
 
97531
7531
531
31
1

class flag
{
int i,j,x;
void show()
{
for(i=0;i< 5;i++)

{
x=9-i*2;
for(j=i;j< 5;j++)
{
System.out.print(x);
x=x-2;
}
System.out.println();
}
}
}


Second pattern:

 55555
4444
333
22
1

class flag1
{
int i,j,x;
void show()
{
for(i=0;i< 5;i++)

{
x=5-i;
for(j=i;j< 5;j++)
{
System.out.print(x);
}
System.out.println();
}
}
}


Related PostBlueJ Programs On Pattern

No comments:

Post a Comment

Subscribe via email

Enter your email address:

Delivered by FeedBurner