display different size circles filled with different colors and at random places using c.

 program to make screen server in that display different size circle filled with different colors and at random places.

  • program:

#include<stdio.h>

#include<conio.h>

#include”graphics.h”

#include”stdlib.h”

void main()

{

intgd=DETECT,gm,i=0, x,xx,y,yy,r;

initgraph(&gd, &gm, “C:\\TC\\BGI”);

x=getmaxx();

y=getmaxy();

while(!kbhit())

{

i++;

circle(xx=random(x), yy=random(y), random(30));

setfillstyle(random(i), random(30));

floodfill(xx,yy,getmaxcolor());

delay(200);

}

getch();

}

  • output:

Leave a comment

Design a site like this with WordPress.com
Get started