# Thread: I thought this would be an interesting thing to try...

1. Member
Join Date
Oct 2011
Posts
2
Rep Power
0

## I thought this would be an interesting thing to try...

I am currently studying java and I am really into it. My professor was speaking about different kinds of things we should be able to do by now, and one of them he mentioned was making a circle out of asterisks. Two examples he gave were a circle inside a circle inside a circle and so on, and another one was a spiral of asterisks with no close. I am really not sure how to go about this now that I think about it, can anybody help me out so I can see how this would be done? Thanks!

2. ## Re: I thought this would be an interesting thing to try...

Do you want to draw that circle in a graphics component or on the console (your terminal). If it is the second option, you have to find a way to draw the circle from top to bottom, left to right or apply some tricks; your turn.

kind regards,

Jos

3. Member
Join Date
Oct 2011
Posts
2
Rep Power
0

## Re: I thought this would be an interesting thing to try...

yes the console. thanks

4. ## Re: I thought this would be an interesting thing to try...

Originally Posted by Azryo
yes the console. thanks
Think in terms of angles; for the angles in the range [0, pi/2] you want to draw half of a circle with radius r (r is an int here because you can only print an int number of lines). So for each line the angle increases pi/2/r radians and the two stars to draw are at positions r+r*sin(a) and r-r*sin(a) where a is such an angle step.

kind regards,

Jos

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•