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.
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);
}
}
a triangle then a square :)
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?
Write a program that calculates the area of a triangle in QBASIC
#include <stdio.h> main() { int r,b,h; printf("Enter the value of Base and Hight"); scanf("%d%d",&b,&h); r = ((b*h)/2); printf("Area of Triangle=%d",r); }
See the related links section for a link to a JAR file containing this program.
a triangle then a square :)
{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 reads in the size of the side of square and then pints a hollow square of that size out of asterisks and blanks?
Write a program that calculates the area of a triangle in QBASIC
#include <stdio.h> main() { int r,b,h; printf("Enter the value of Base and Hight"); scanf("%d%d",&b,&h); r = ((b*h)/2); printf("Area of Triangle=%d",r); }
Try the triangle program on a search engine. Replace numbers with stars and that should do the trick
yea
No
Write a function that print a triangle of stars.
Use a text-editor.
See the related links section for a link to a JAR file containing this program.
write a c++ programe to print a triangle without (for)