C Program to Draw a Square using Graphics

#include<stdio.h>
#include<conio.h>
#include<graphics.h>
main()
{
  int gd, gm, s;
  gd=DETECT;
  initgraph(&gd, &gm, "C:\\TC\\BGI");
  clrscr();
  printf("Enter the value of side of square:");
  scanf("%d",&s);
  setbkcolor(LIGHTGRAY);
  setcolor(RED);
  moveto(50,50);
  lineto(50+s,50);
  lineto(50+s,50+s);
  lineto(50,50+s);
  lineto(50,50);
  outtextxy(20, 450, "Press any key to continue...");
  getch();
closegraph();
}

Output:
C Program to Draw a Square using Graphics