answersLogoWhite

0

Write a program to make a triangle?

Updated: 8/11/2023
User Avatar

Wiki User

15y ago

Best Answer

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

15y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

11y ago

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);

}

}

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

#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(); }

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

#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;

}

This answer is:
User Avatar

User Avatar

Wiki User

9y ago

area of triangle using c language

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

area=0.5*base*height

This answer is:
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
Related questions

Write a program in qbasic to make a hut using print statemant?

a triangle then a square :)


Write a pascal program that compute an area of a triangle?

{A program to compute the area of a triangle} {by Ogboin W. Meshach} Var; b,h:real; BEGIN Writeln('Triangle'); Write('Base: '); Readln(base); Write('Height: '); Readln(height); area:=0.5*base*height; Writeln('Area: ', area :0:2); End.


Write a program that input a positive integer and prints a triangle using for loop?

write a program that reads in the size of the side of square and then pints a hollow square of that size out of asterisks and blanks?


How do you write a qbasic program to find area and circumerence of a circle?

Write a program that calculates the area of a triangle in QBASIC


Write a program to calculate area of triangle and check whether entered sides can make triangle or not..?

#include &lt;stdio.h&gt; main() { int r,b,h; printf("Enter the value of Base and Hight"); scanf("%d%d",&amp;b,&amp;h); r = ((b*h)/2); printf("Area of Triangle=%d",r); }


How do you write a program to print numbers from star one and next line star two in php?

Try the triangle program on a search engine. Replace numbers with stars and that should do the trick


Was there a program called the triangle?

yea


Can a write triangle be equilateral?

No


Write a C plus plus function that print a triangle of stars?

Write a function that print a triangle of stars.


How do you write a program for triangle pattern 1 3 5 7 5 7 9 11 7 9 11 13?

Use a text-editor.


How do you write a java program to make a periodic table?

See the related links section for a link to a JAR file containing this program.


How do you print a triangle of stars?

write a c++ programe to print a triangle without (for)