C program to Draw A rainbow 
C program to Draw A rainbow 

Write a C program to Draw A rainbow using Graphics in C examples PDF 

C program to Draw A rainbow

 A-C program to Draw a rainbow. This program would only work in the Turbo C compiler in the DOS-compatible machine. The Pdf link is Below the Image.

Creating a Rainbow using Graphics Programming in C

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

Thank you for reading this post, don't forget to subscribe!

// function for making of rainbow
void rainbow()
{

// auto detection
int gdriver = DETECT,gmode;
int x, y, i;

initgraph(&gdriver,&gmode,”C:\\Turboc3\\BGI“);

// message

printf(“\nThis is a Rainbow“);

//for background color
setbkcolor(BLUE+WHITE);

//finding centre x-ordinate of screen

x = getmaxx() / 2;

//finding centre y-ordinate of screen
y = getmaxy() / 2;

for (i=30; i<200; i++)
{

delay(100);

// select color for making of rainbow
setcolor(i/10);

//arc making with fixed centre and increasing radius
arc(x, y, 0, 180, i-10);
}
}
// driver program
int main()
{
rainbow();
return 0;
}

Example of graphics program in C

C program to Draw A rainbow 
C program to Draw A rainbow

 

Graphics program in c examples pdf

[button-blue url=”http://thesmolt.com/wp-content/uploads/2020/09/Write-a-C-program-to-Draw-A-rainbow-using-Graphics-in-C-examples-PDF-.zip” target=”_self” position=””]Download PDF[/button-blue]

Explanation of Graphics Program

(initgraph);- This function is used for initializing graphics mode(were passed three arguments to
initgraph function)

&gdriver:-This is the address of gdriver (Graphics Driver) variable.
&gmode:- This is the address of gmode (Graphics Mode)

“C:\\Turboc3\\BGI”:- This is the directory path where BGI files are stored, This directory only work with Turbo C (DOS) Editor.

delay();- delay function stored under dos.h for holding the
function for some time.

C program to Draw A rainbow 
C program to Draw A rainbow

 

END

Write a C program To draw Rainbow

C program to draw a square using graphics (clickHere)

Full Circle wise Rainbow Program (clickHere)

 

Note:- Maybe sometime above code doesn’t get user-friendly output, in codeblock ‘or’ any other EDITOR, All of C & C++ program tested in DOS compiler Turbo C.

Also Read

Types of functions in C    [button-blue url=”http://thesmolt.com/functions-in-c-and-graphics/” target=”_self” position=”right”]Read Here[/button-blue]

I hope you will understand better if you study at M.U, in the exam of M.U you know how important this “C program to draw a A rainbow using graphics. So please don’t forget to give your valuable feedback. Go in the comment section and Give us some feedback about it. C program to draw a A rainbow or My website.

Our team check your every Comment per day Because your one feedback helps us in growing Thesmolt

I request you if you have any doubt or question regarding our site, then please don’t hesitate. We always waiting for your Suggestion.

Note:- If you want to Download This article’s in PDF form, then simply go (Top or Bottom of) Right corner and click on the PRINT icon, and it’s saved as a PDF of C program to draw a A rainbow

 

For further questions, you can contact us Via mail Ask@thesmolt.com  otherwise, Our Help Page and Contact us Page, which is included below. I hope I’ll able to say all the possible ways to reach us. Or Download My Android Application Below Download Button.

thesmolt App

Saurabh Nissa

This is SaurabhNissa, Owner of Thesmolt.com I'm Graduated from Magadh University in 2019 with 75%. Currently, I'm working on my Personal educational website for teaching Programming language free of Coast, and want to provide a Full setup for Specially BCA student