Thursday , September 21 2017
Home / C / Program in C to draw a TRIANGLE

Program in C to draw a TRIANGLE

Here is the program for creating a triangle in C.

#include<conio.h>
#include<stdio.h>
#include<graphics.h>
void main()
{
int gd=DETECT,gm;
initgraph(&gd,&gm,"C:\\TC\\bgi");
line(150,100,100,200);
line(100,200,200,200);
line(200,200,150,100);
getch();
closegraph();
}

OUTPUT:

Tags: c program to draw a triangle, graphics program to draw a triangle, create

Check Also

How to Solve Linear Equation in One Variable In C Programming?

C Program to Solve any Linear Equation in One Variable Find complete C program to ...

2 comments

  1. i need the 2d TRANSFORMATION translation coding only using line(), pls explain it by using this method

  2. Well we can do this thing by passing an array and then using the command drawpoly(1 ,2).
    Where 1 represents no. of sides which should be one more than the shape to be output here in this case 4 as we have to output triangle and 2 represents the name of the array which contain the coordinates of triangle.

Leave a Reply

Your email address will not be published. Required fields are marked *