answersLogoWhite

0

To draw a random triangle.... Declare six variables.... H1 and V1 H2 and V2 H3 and V3 Then using the random function apply the random to the height of your form - this will be H1 Do the same with the width of the form - this will be V1 -- do this twice more, for H2 and V2 - and then for H3 and V3.. Then draw a line from (H1, V1) to (H2, V2) Draw another line from (H1, V1) to (H3, V3) Draw the last line from (H2, V2) to (H3, V3) -- I can't guarantee it will look great, but it _will_ be a triangle. ==== To draw a specific triangle you need much more coding, involving sine rule an other trigonometry.

User Avatar

Wiki User

16y ago

Still curious? Ask our experts.

Chat with our AI personalities

LaoLao
The path is yours to walk; I am only here to hold up a mirror.
Chat with Lao
DevinDevin
I've poured enough drinks to know that people don't always want advice—they just want to talk.
Chat with Devin
ViviVivi
Your ride-or-die bestie who's seen you through every high and low.
Chat with Vivi
More answers

java.util.Scanner;public class Triangle {

public static void main(String[] args) {

Scanner input = new Scanner(System.in);

double base = 0;

double height = 0;

double area = 0;

System.out.print("Enter the length of base of triangle : ");

base = input.nextDouble();

System.out.print("Enter the length of height of triangle : ");

height = input.nextDouble();

area = (base * height) / 2;

System.out.println("");

System.out.println("The Area of Triangle is : "

+ area);

}

}

User Avatar

Wiki User

12y ago
User Avatar

#include<stdio.h> #include<conio.h> void main() { float base,height,area; clrscr(); printf("\nENTER THE BASE OF TRIANGLE\t"); scanf("%f",&base); printf("\nENTER THE HEIGHT OF TRIANGLE\t"); scanf("%f",&height); area=0.5*(base*height); printf("\nTHE AREA OF TRIANGLE IS :-----%f",area); getch(); }

User Avatar

Wiki User

15y ago
User Avatar

#include<stdio.h>

#include<math.h>

int main()

{

float a,b,c,s,area;

printf("\n Enter the three sides of triangle\n");

scanf("%f%f%f",&a,&b,&c);

s=(a+b+c)/2;

area=sqrt(s*(s-a)*(s-b)*(s-c));

printf("\n area of the triangle is %f", area);

return 0;

}

User Avatar

Wiki User

13y ago
User Avatar

area of triangle using c language

User Avatar

Wiki User

10y ago
User Avatar

area=0.5*base*height

User Avatar

Wiki User

12y ago
User Avatar

Add your answer:

Earn +20 pts
Q: Write a program to make a triangle?
Write your answer...
Submit
Still have questions?
magnify glass
imp