Feb 1, 2009

Using the character w write a c code that draws a circle on the screen ( ie draw a circle and shade it with w)

Using the character w write a c code that draws a circle on the screen ( ie draw a circle and shade it with w)
#include
const int xRange = 40;
const int yRange = 30;
const int radius = 25;
int main () {
int x, y;
for (y = -yRange; y < yRange; y+=2) {
for (x = -xRange; x < xRange; x++) {
if (x*x + y*y > radius * radius) {
printf (" ");
} else {
printf ("w");
}
}
printf ("\n");
}
return 0;
}

No comments:

Post a Comment