Skip to content

Instantly share code, notes, and snippets.

@shalithasuranga
Last active November 22, 2020 06:12
Show Gist options
  • Save shalithasuranga/0ca72ad75047f00f654e295e70a61911 to your computer and use it in GitHub Desktop.
Save shalithasuranga/0ca72ad75047f00f654e295e70a61911 to your computer and use it in GitHub Desktop.
const xSize = 50;
const ySize = 50;
const R = 10;
let output = "";
for(let x = 0; x < xSize; x ++) {
for(let y = 0; y < ySize;y ++) {
if(Math.sqrt(Math.pow(x - xSize / 2, 2) + Math.pow(y - ySize / 2, 2)) <= R)
output += "**";
else
output += " ";
}
output += "\n";
}
console.log(output);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment