Go to Top

Monday 19 February 2018

Readers request - 7

Hello Keshab !

You had asked for the program to print the following pattern :

1 2 3 4 5
2 3 4 5
3 4 5
4 5
5


Java Program :
class keshabs_query
{
    public static void main(String args[])
    {
        int i,j;
        for(i=1;i<=5;i++)
        {
            for(j=i;j<=5;j++)
            {
                System.out.print(j);
            }
            System.out.print("\n");
        }
    }
}


P.S. - I honestly want to thank all the young programmers out here who have been helping the others in doubt, and contributing to keep this blog lively enough. I am back from my hiatus and will try to revamp this forum with new and good content, as always (*wink).

ShareThis