Draw a circle on console in some different languages.

Thu, Aug 25 2022

Hi There

Welcome to another blog post. Math is great at all. We used various kinds of math in our schools and colleges. In most cases programming is depended on math. 

Anyway , lets jump into the topic. Lets try to draw a circle on console using some programming languages. We will mathematical circle equation and it's (x - a)2 + (y - b)2 = r

But I am going to use it like dx2 + dy2 = r2

I used same condition ( if dx2 + dy2 less or equal than r2 ) according to the equation.

So These are codes bellow : 






You can draw a circle using above code. Output should be circle drawn with # on terminal like below :



Javascript (I used nodejs to run the code in terminal as you can see...)

PHP (I run the code in terminal using php cli)



These all programs are done only one work. This instance about the work of all programming languages are same but different syntax. : )