Sunday, August 6, 2017

c program for National Flag of India


//C graphics program for National Flag of India with output pdf download
#include<graphics.h>
#include<stdio.h>
#include<conio.h>
void main()
{
int gd=DETECT,gm,i;
initgraph(&gd,&gm,"");
for(i=0;i<getmaxy()/3;i++)
{
setcolor(4);
line(0,i,getmaxx(),i);
}
for(i=getmaxy()/3;i<getmaxy()*2/3;i++)
{
setcolor(15);
line(0,i,getmaxx(),i);
}
for(i=getmaxy()*2/3;i<=getmaxy();i++)
{
setcolor(GREEN);
line(0,i,getmaxx(),i);
}
setcolor(BLUE);
for(i=0;i<360;i+=15)
pieslice(getmaxx()/2, getmaxy()/2, i,i+15, 80);
getch();
closegraph();
}