public class HeartPattern {
public static void main(String[] args) {
for (double y = 1.5; y > -1.5; y -= 0.1) {
for (double x = -1.5; x < 1.5; x += 0.05) {
double a = x * x + y * y - 1;
if (a * a * a - x * x * y * y * y <= 0.0) {
System.out.print("*");
} else {
System.out.print(" ");
}
}
System.out.println();
}
}
}
用java代码打印爱心
最新推荐文章于 2024-05-19 08:32:35 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)