fork download
  1. import java.lang.Math;
  2.  
  3. public class Main {
  4. public static boolean inCircle(int x, int y) {
  5. int xDif = Math.abs(x - 10);
  6. int yDif = Math.abs(y - 10);
  7.  
  8. return Math.sqrt((xDif * xDif) + (yDif * yDif)) <= 10;
  9. }
  10.  
  11. public static void main(String[] args) {
  12. for (int x = 0; x < 20; x++) {
  13. for (int y = 0; y < 20; x++) {
  14. if (inCircle(x, y)) {
  15. System.out.print("O");
  16. } else {
  17. System.out.print(" ");
  18. }
  19. }
  20. System.out.println();
  21. }
  22. }
  23. }
Runtime error #stdin #stdout 0.47s 320704KB
stdin
Standard input is empty
stdout
          O