Skip to content

Sucharita993/Pyramid-Pattern

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Pyramid-Pattern

A simple java program on pyramid pattern.
To make the program simple we did not use any Scanner class for input.
For loop is being used mainly.

for(i=1;i<=n;i++)
		{
		for(j=1;j<=l;j++)
		{
		System.out.print(" ");
		}
		  for(k=1;k<=2*i-1;k++)
    		{
	    	System.out.print("*");
		    }
  		l--;
	  }

in the last for loop we have used the formula

		for(k=1;k<=2*i-1;k++)

since we need a pyramid pattern of

     *
    ***
   *****
  *******
 *********

which is of the order 2*i-1.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages