series-8

 1 2 3 4 5

1 2 3 4 1

1 2 3 1 2

1 2 1 2 3


class series

{

public static void main(String args[])

{

int a,d=5;

for(int r=1;r<=5;r++)

{

a=1;

for (int c=1 ; c<=5 ; c++)

{

if(c<=d)

System.out.print(c);

else

System.out.print(a++)

}

d--;

System.out.println() // to come to next line

}

}

}


Comments

Post a Comment

Popular posts from this blog