Q. Write a program to draw a right angle triangle and set the line color as RED.
#BIT_2017_2a_4Marks_Solution
==> Code goes like this :
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
main() {
int gd = DETECT, gm;
initgraph(&gd, &gm, "c:\\tc\\bgi");
line(150, 50, 150, 300);
line(150, 50, 500, 300);
line(150, 300, 500, 300);
setcolor(RED);
getch();
closegraph();
}
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
Draw a right angle triangle and set the line color as RED - C
8:58 PM
C Programs
,
drawing right angle triangle in c
,
Graphics in C
,
OldQuestionSolution2017C
Edit
0 comments:
Post a Comment