Sunday, March 18, 2018

Write a java program to print this numeric pattern 1 2 3 4 8 7 6 5 9 10 11 12 16 15 14 13


Write a java program to print this numeric pattern

1  2  3  4
8  7  6  5
9 10 11 12
16 15 14 13



public class NumericPattern
{
public static void main(String[] args)throws Exception {
int c=0;
for(int i=1;i<=4;i++)
{
if(i%2==1)
{
for(int j=1;j<=4;j++)
System.out.print("   "+ ++c);
c=c+4;
}
else
{
int t=c;
for(int k=1;k<=4;k++)
{
System.out.print("   "+t--);
}
}
System.out.println();
}
}
}




Write a java program to print this numeric pattern     1  2  3  4   8  7  6  5   9 10 11 12   16 15 14 13
Write a java program to print this numeric pattern. [All Java Interview Programs]

Share this

0 Comment to "Write a java program to print this numeric pattern 1 2 3 4 8 7 6 5 9 10 11 12 16 15 14 13 "

Post a Comment