Skip to main content

Posts

Showing posts with the label Circle in c

Circle in C with ASCII

Hi , Here is the small program,generating a circle in c with ASCII in linux environment. Surface:50X50 Radius:15 Formula: (x-CC)2+(y-CC)2=radius2 Here CC=Circle Center x,y are the surface pointers. #include "stdio.h" #include "math.h" int main() { int i,j,rad; rad=15; for (i=0; i { for (j=0; j { if(sqrt((j-(50)/2)*(j-(50)/2) + (i-(50)/2)*(i-(50)/2)) printf("."); else printf(" "); } printf("\n"); } return 0; } Complile:- -------------- gcc -o circ circ.c -lm