BlueJ and Python For ICSE ISC and CBSE
.
Tuesday, June 22, 2021
BlueJ Pattern 1234 4321 and So On
Print the pattern
1 2 3 4
4 3 2 1
1 2 3 4
4 3 2 1
class Pat
{
int i,j;
void show(int n)
{
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
if(i%2!=0)
System.out.print(j+ " ");
else
System.out.print((n+1-j)+ " ");
}
System.out.println();
}
}
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
Subscribe via email
Enter your email address:
Delivered by
FeedBurner
No comments:
Post a Comment