C Program to Draw 3D Bar Chart using Graphics

#include<stdio.h>
#include<conio.h>
#include<graphics.h>
main()
{
  int gd, gm, i, xsales;
  gd=DETECT;
  initgraph(&gd, &gm, "C:\\TC\\BGI");
  int sales[]={200, 590, 670, 435};
  setcolor(RED);
  setlinestyle(SOLID_LINE, 0, NORM_WIDTH);
  setfillstyle(SOLID_FILL, RED);
  for(i=0;i<=3;i++)
   {
    xsales=scale(sales[i],300);
    bar3d(0,15+i*50, xsales, (i+1)*50,10,1);
    }
  outtextxy(100, 350, " 3D BAR CHART ");
  outtextxy(20, 450, "Press any key to continue...");
  getch();
closegraph();
}
int scale(int value, int factor)
{
  int max;
  max=getmaxx();
  return(int) ((float) (value)*factor/max);
}

Output:
C Program to Draw 3D Bar Chart using Graphics