Thursday, December 4, 2014

BlueJ Program To Print A Pattern On The Word INDIA



        
        In this program, the word INDIA will displayed as
     
        INDIA
        INDI
        IND
        IN
        I

      
       class India
{
   int i,j,len;
   String s1="INDIA";
    public void showPattern()throws Exception
    {
       len=s1.length();
       for(i=0;i< len;i++)
       {
            for(j=0;j< len-i;j++)
            {
             System.out.print(s1.charAt(j));
            }
            System.out.println();
        }
    }
        public static void main(String args[])throws Exception
        {
             India ob=new India();
             ob.showPattern();
            }


        }

Related Post:  BlueJ Programs on String/Sentence
Related PostBlueJ Programs On Pattern

No comments:

Post a Comment

Subscribe via email

Enter your email address:

Delivered by FeedBurner