Saturday, 6 June 2015

Pyramid Design in Java

    1
   232
  34543
 4567654
567898765
public class PyramidDesign
{
  public static void main(String soham[])
  {
    String str = "123456789";
    
    PyramidDesign pd = new PyramidDesign();

    for(int i=0; i<=4; i++)
    {
      pd.display(i,str);
      System.out.println();
    }
  }
  
  public void display(int start,String str)
  {
    int i,j;
    for(i=start; i<=(start+start); i++)
    {
      System.out.print(""+str.charAt(i));
    }
    
    for(j=(i-2); j >= start; j--)
    {
      System.out.print(""+str.charAt(j));
    }
  }
}

7 comments:

  1. hi admin.i am really love it your blog.Because your explanation wise all the topics are too good..
    Java Training in Marathahalli
    Python Training in Marathahalli

    ReplyDelete
  2. I believe there are many more pleasurable opportunities ahead for
    individuals that looked at your site.If you want to Get more
    Java Training in Chennai

    ReplyDelete
  3. It is most knowledgeable information like this.I will read this article it is very easy to learn this blog.
    Best Selenium Training Institute in Chennai | Selenium Training Institute in Velachery

    ReplyDelete
  4. You have done a great job, really the concept of Java was superb, its very interesting and easy to understand also.. Keep updating such a nice blog..
    Automation Anywhere Training in Chennai | RPA Training Institute in Chennai | UI Path Training Institute in Chennai | Blue Prism Training Institute in Chennai

    ReplyDelete
  5. Very interesting and useful stuff found here with clean and neat explanation. Thank you for giving us such an information...
    Best Online Software Training Institute | Advanced Java Training

    ReplyDelete
  6. I feel really happy to have seen your webpage and look forward to so many more entertaining times reading here. Thanks once more for all the details.


    rpa Training in Bangalore


    ReplyDelete