Q:

Write a C program to implement Spiral Model in Graphics

0

Write a C program to implement Spiral Model in Graphics. Here’s simple program to implement Spiral Model in Graphics in C Programming Language.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Below is the source code for C program to implement Spiral Model in Graphics which is successfully compiled and run on Windows System to produce desired output as shown below :

 
 


SOURCE CODE : :

/*  C program to implement Spiral Model in Graphics  */

#include<graphics.h>
#include<stdio.h>
#include<conio.h>
 
void main()
{
        int r=5,n,i,x,y;
        int graphdriver = DETECT, graphmode;
        initgraph(&graphdriver, &graphmode, "..\\bgi");
 
        setcolor(YELLOW);
        printf("ENTER THE NUMBER OF RINGS IN THE SPIRAL MODEL\n");
        scanf("%d",&n);
        printf("Enter the origin point of the spiral");
        scanf("%d%d",&x,&y);
        clrscr();
        for(i=0;i<n;i++)
        {
                 arc(x,y,0,180,r=r+2);
                 arc(x+2,y,180,360,r=r+2);
        }
        getch();
        closegraph();
}

Above is the source code for C program to implement Spiral Models in Graphics which is successfully compiled and run on Windows System.The Output of the program is shown above .

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C Graphic Solved Programs – C Programming

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Write a C program to implement Bar Graph in Graphi... >>
<< Write a C program to implement Rotation of wheel i...