DEV Community

hema latha
hema latha

Posted on

pattern for loop

int val= 10;
        for (int row = 1; row<=4; row ++ )
   {
       for(int col = 1; col<=row; col++)
       {
           System.out.print(val+" ");
           val--;
       }
       System.out.println();

}

out put 
10 
9 8 
7 6 5 
4 3 2 1 
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →