Home / C / Program in C to Draw Concentric Circle using graphics

Program in C to Draw Concentric Circle using graphics

#include<stdio.h>
#include<graphics.h>
#include<conio.h>
void main()
{
int rc, rb, xc, yc, i;
float x,y;
int gd=DETECT, gm;
initgraph(&gd,&gm,"c:\\tc\\bgi");
printf("enter the radius of the outer circle \n");
scanf("%d",&rc);
printf("enter the radius of the inner circle \n");
scanf("%d", &rb);
printf("enter the center of the circle");
scanf("%d",&xc);
scanf("%d",&yc);
for(i=1;i<=360;i++)
{
  x=xc+(rb*(cos(i)));
  y=yc+(rb*(sin(i)));
  putpixel(x,y,7);
  }
for(i=1;i<=360;i++)
{
  x=xc+(rc*(cos(i)));
  y=yc+(rc*(sin(i)));
  putpixel(x,y,7);
  }
  getch();
  closegraph();
  }

 

OUTPUT

Tags: Cicrle drawing, concentric circles, how to draw concentric circle in C, program in C to draw Concentric Circle

Check Also

Restrict Mouse Pointer Position C Graphics Program

This C Program will restrict the Mouse Pointer location or to a particular position or x,y ...

Leave a Reply

Your email address will not be published. Required fields are marked *

Preventing spam * Time limit is exhausted. Please reload the CAPTCHA.