Skip to content

Instantly share code, notes, and snippets.

@ForLoopCodes
Created October 21, 2025 12:26
Show Gist options
  • Select an option

  • Save ForLoopCodes/561956026cd11d3c54beb452874a2630 to your computer and use it in GitHub Desktop.

Select an option

Save ForLoopCodes/561956026cd11d3c54beb452874a2630 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <math.h>
#define PI 3.14159265358979323846
#define RADIUS 10
int main() {
char grid[RADIUS * 2][RADIUS * 4];
for (int i = 0; i < RADIUS * 2; i++) {
for (int j = 0; j < RADIUS * 4; j++) {
grid[i][j] = ' ';
}
}
for (double theta = 0; theta < 2.0 * PI; theta += 0.01) {
int x = (int)((RADIUS + RADIUS * sin(theta)) * 2.0);
int y = (int)(RADIUS + RADIUS * cos(theta));
grid[y][x] = '*';
}
for (int i = 0; i < RADIUS * 2; i++) {
for (int j = 0; j < RADIUS * 4; j++) {
putchar(grid[i][j]);
}
putchar('\n');
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment