what about this pattern: without matrix in java
1 2 3 4
8 7 6 5
9 10 11 12
16 15 14 13
{
static void printPattern(int n)
{
int count = 1;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
{
if(i%2!=0)
{
System.out.print(count++);
}
else
{
System.out.print(count--);
}
}
if(i%2!=0)
{
count = count+3;
}
else
{
count = count+5;
}
System.out.println();
}
}
public static void main(String[] args)
{
printPattern(4);
}
}
4 comments
Nice information thanks for sharing
reliaable residenza
Nice information
Sobha Dream Gardens
E-commerce sites like Amazon and online entertainment sites like Netflix are using it to recommend new products and movies based on users' past experiences. data science course syllabus
Very nice blog and articles. I am realy very happy to visit your blog. Now I am found which I actually want. I check your blog everyday and try to learn something from your blog. Thank you and waiting for your new post.
data science course in India
EmoticonEmoticon