Skip to content

Instantly share code, notes, and snippets.

@takanakahiko
Created December 21, 2014 12:08
Show Gist options
  • Save takanakahiko/eba092a025069b376959 to your computer and use it in GitHub Desktop.
Save takanakahiko/eba092a025069b376959 to your computer and use it in GitHub Desktop.
円を描くやつ
class DrawCircle{
public static void main(String[] args){
int hankei = 10; //ここ可変
for(int i = 0; i < hankei*2+1; i ++){
for(int j = 0; j < hankei*2+1; j ++){
System.out.print(" "); //windowsでは行間がひろいためスペーサーが必要
if( (hankei-i)*(hankei-i)+(hankei-j)*(hankei-j) < hankei*hankei){
System.out.print("*");
}else{
System.out.print(" ");
}
}
System.out.println("");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment