import java.io.Console;
public class pyramidtengah {
public static void main (String[] args){
int i;
int j;
System.out.print("tingggi : ");
String in=System.console().readLine();
int t = Integer.parseInt(in);
System.out.println();
for (i=1; i<= t; i++){
for (j=1; j<=t-i; j++){
System.out.print(' ');
}
for (j=1; j<=i; j++){
System.out.print('*');
}
for (j=1; j<=i-1; j++){
System.out.print('*');
}
System.out.println();
}
}
}
public class pyramidtengah {
public static void main (String[] args){
int i;
int j;
System.out.print("tingggi : ");
String in=System.console().readLine();
int t = Integer.parseInt(in);
System.out.println();
for (i=1; i<= t; i++){
for (j=1; j<=t-i; j++){
System.out.print(' ');
}
for (j=1; j<=i; j++){
System.out.print('*');
}
for (j=1; j<=i-1; j++){
System.out.print('*');
}
System.out.println();
}
}
}
0 comments