The pattern would be like:
     1 2 3 4 *
     1 2 3 * 5
     1 2 * 4 5
     1 * 3 4 5
     * 2 3 4 5
Here is the BlueJ program.
class S
{
   int i,j;
   int x;
    public void show()
    {
        for(i=0;i< 5;i++)
        {
            x=1;
            for(j=0;j< 5;j++)
            {
                 if(i+j==4)
                
System.out.print("*");
                 else
                
System.out.print(x++);
                }
               
System.out.println();
            }      
    }
        public static void
main(String args[])
        {
             S ob=new
S();
             ob.show();
            }
No comments:
Post a Comment