Q. Write C program to display:
a) a rectangle whose height is 200 pixels and width is 400 pixels
b) a circle whose diameter is 200 pixels
#BIT_FirstSem_2015_8No_8Marks_Solution
==> Code goes like this:
#include<stdio.h>
#include<graphics.h>
int main()
{
int gd=DETECT,gm;
initgraph (&gd,&gm,"C:\\TC:\\BGI");
rectangle(100,100,500,300); //width 400 and height 200
circle(350,450,100); //circle with 200 diameter in 600, 600
getch();
closegraph();
return 0;
}
Output:
If you are using Turbo C++ IDE, then use conio.h in link section after stdio.h
and use getch(); to hold the output screen, just before the end of main function.
If you have any confusion regarding the program, please, comment below.
Happy Coding !
Thank you
Drawing rectangle and circle in C
6:20 PM
C Programs
,
drawing circle and rectangle in c
,
Graphics in C
,
OldQuestionSolution2015C
Edit
0 comments:
Post a Comment