Robert Ryan wrote:
> here is a code for making a triangle. can anyone change this to make a circle
> #include<stdio.h>
> int main()
> {
> int tr=10,r,c,s, o=1;
>
> for(r=1; r<=tr; r++)
> {
> for(c=1;c<=tr- r;c++)
> {
> printf(" ");
> }
> for(s=1;s<=o; s++)
> printf("c");
> printf("\n") ;
> o=o+2;
> }
> return 0;
> }
You are going to get much more mileage by starting over instead of
adapting an unrelated geometric figure to a circle. Rick mentioned
graph paper. Draw 1x1, 2x2, 3x3, 4x4, 5x5, 6x6, and 7x7 circles on
graph paper. But don't draw actual circles. Fill in blocks on the
paper that represent each circle. Draw a box around each circle. Then
figure out how to fill in that box by scanning horizontally.
Hint: (x - a)^2 + (y - b)^2 = r^2
http://en.wikipedia.org/wiki/Circle
--
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197
*NEW* MyTaskFocus 1.1
Get on task. Stay on task.
http://www.CubicleSoft.com/MyTaskFocus/