Program to Draw multi colour rectangles in rectangle

#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>


void main()
{
  clrscr();
  int gm=DETECT,gd,i;
  int xmin=0,ymin=0,xmax=639,ymax=479;


   initgraph(&gm,&gd,"");
  for(i=0;i<15;i++)
  {
    setcolor (i+1);
   rectangle(xmin,ymin,xmax,ymax);
   xmin+=20;    xmax-=20;
   ymin+=16;     ymax-=16;

     }
  getch();
}

Leave a Reply