class ForFor2 {
public static void main(String[] args)
{
/*for (int i = 1; i <= 5; i++){ //倒三角
System.out.print(" ");
for (int j = 1; j <= (5-i); j++){
System.out.print("*");
}
System.out.println();
}*/
for (int i = 1; i <= 5; i++){ //等边三角形
System.out.print(" ");
for (int j = 1; j <= (5-i); j = 2*i+1){
System.out.print("*");
}
System.out.println();
}
}
|
|