Tuesday, 1 March 2016

Types of pyramid programs pattern 13



Program
class Main{
public static void main(String args[]){
int i,j;
for(i=1;i<=5;i++){
for(j=1;j<=5-i;j++)
System.out.print(" ");
for(j=1;j<=i;j++)
System.out.print("*");
for(j=1;j<i;j++)
System.out.print("*");
System.out.println("");
}
for(i=1;i<=5;i++){
for(j=1;j<i;j++)
System.out.print(" ");
for(j=10-i;j>=i;j--)
System.out.print("*");
System.out.println("");
}          
}
}


OUTPUT:- 
C:\Users\Saty\Desktop\java>javac 1.java
C:\Users\Saty\Desktop\java>java Main
    *
   ***
  *****
 *******
*********
*********
 *******
  *****
   ***
    *

No comments:

Post a Comment