need help!!! to fix my program please!!!

Thread Solved

Join Date: Oct 2009
Posts: 21
Reputation: needhelpe is an unknown quantity at this point 
Solved Threads: 0
needhelpe needhelpe is offline Offline
Newbie Poster

need help!!! to fix my program please!!!

 
0
  #1
18 Days Ago
I made a program that inputs the radius of a circle, and then should output a circle of asterisks. however, I am just getting the fourth-quadrant part of the circle, and I need the whole circle to be printout. what do I need in my code?

this is my code:

#include <stdio.h>
#define x 25

int main()
{
char A[x][x];
int r, i, j;

printf("Radius: ");
scanf("%d", &r);

for(i=0; i<=r; i++)
{
for(j=0; j<=r; j++)
{
if(i*i + j*j <= r*r)
A[i][j]= '*'

else
A[i][j]= ' ';
}
}

for(i=o; i<=r; i++)
{
for(j=o; j<=r; j++)
printf("%c", A[i][j]);

printf("\n");
}

return 0;
}
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC