Created
December 21, 2014 12:08
-
-
Save takanakahiko/eba092a025069b376959 to your computer and use it in GitHub Desktop.
円を描くやつ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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