Pattern Prinitng

How to do the following pattern
12345
2345
345
45
5

class Pattern
    {
        public static void main(String args[])
        {
            for(int i=1; i<=5; i++)
            {
                for(int j=i; j<=5; j++)
                {
                    System.out.print(j);
                }
                System.out.println();
            }
        }
    }

No comments:

Post a Comment