10/05/2016

Draw ranbow using C graphics

Draw Rainbow using C Graphics.

#include<stdio.h>
#include<graphics.h>
#include<dos.h>
void main(){
int i , gd = DETECT , gm;
initgraph(&gd , &gm ,"c:\\tc\\bgi");

for(i = 0 ; i < 350 ; i++)
{
if(i % 25 == 0)
setcolor(rand() % 16);
arc(350 , 400 , 0 , 180 , i) ;
delay(10);
}
getch(); 

closegraph();
}

Output:



2 comments: