Monday , December 18 2017
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
Also See:   C program for Prim's Algorithm

Check Also

How to Solve Linear Equation in One Variable In C Programming?

C Program to Solve any Linear Equation in One Variable Find complete C program to ...

Leave a Reply

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