| | |
need help!!! to fix my program please!!!
Thread Solved |
•
•
Join Date: Oct 2009
Posts: 21
Reputation:
Solved Threads: 0
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;
}
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;
}
![]() |
Similar Threads
- help me fix my program(strtok,strcmp,array) (C)
- can someone help me to correct this program?[urgent] (C++)
- HELP my c++ program!!!! (C++)
- Help with a seemingly simple program (C++)
- I still need help with my program!! (Java)
- why this sample program doesen't work? (C++)
- Need help writing a program (C++)
- a program about fractions (C++)
Other Threads in the C Forum
- Previous Thread: Hwk: how do I make a 2d array of pointers point to another array
- Next Thread: Reading from the Command line
| Thread Tools | Search this Thread |
* adobe ansi api array arrays binarysearch calculate centimeter changingto char character cm convert copyanyfile copypdffile createcopyoffile createprocess() csyntax directory dynamic fflush file floatingpointvalidation fork forloop frequency getlasterror getlogicaldrivestrin givemetehcodez global graphics gtkgcurlcompiling gtkwinlinux hardware highest histogram homework i/o inches intmain() iso km license linked linkedlist linux linuxsegmentationfault list logical_drives loopinsideloop. lowest match matrix microsoft motherboard mqqueue mysql oddnumber odf open opendocumentformat openwebfoundation pattern pdf performance pointer posix power program programming pyramidusingturboccodes read recursion recv recvblocked repetition reversing scanf scheduling segmentationfault send shape single socketprogramming stack standard strchr string suggestions test unix urboc user variable voidmain() whythiscodecausesegmentationfault win32api windows.h windowsapi





