/*
打印心形
*/
class Demo_Heart {
public static void main(String[] args) {
System.out.println(" * * * * * *");
System.out.println(" * * * *");
System.out.println(" * * *");
for (int i = 1;i <= 5;i++ ) {
for (int j = 1;j <= 2 * i - 1 ;j++ ) {
System.out.print(" ");
}
System.out.print("*");
for (int m = 1;m <= 23 - 4 * i ;m++ ) {
System.out.print(" ");
}
System.out.println("*");
}
System.out.println(" *");
}
}
|
|