实现如下效果
import java.util.Scanner;
class paintcircle
{
public static void main(String[] args)
{
System.out.print("请输入圆的半径:");
Scanner sc=new Scanner(System.in);
int r=sc.nextInt();
for(int y=0; y<=2*r;y+=2){
int x=(int)Math.round(r-Math.sqrt(r*r-(r-y)*(r-y)));
int l=2*(r-x);
for(int i=0;i<=x;i++){
System.out.print(" ");
}
System.out.print("*");
for(int j=0;j<=l;j++){
System.out.print(" ");
}
System.out.println("*");
}
}
}